-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Account for time taken to write index buffers in IndexingMemoryController #126786
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Hi @ankikuma, I've created a changelog YAML for you. |
Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing) |
…ch into 04142025/IWLES11356 commit pull
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, can we add a test where we exercise this and see how the write load increases when the IndexingMemoryController
flushes the buffers to disk?
server/src/main/java/org/elasticsearch/indices/IndexingMemoryController.java
Outdated
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/shard/InternalIndexingStats.java
Show resolved
Hide resolved
server/src/main/java/org/elasticsearch/index/shard/InternalIndexingStats.java
Outdated
Show resolved
Hide resolved
@fcofdez I added a test to IndexingMemoryControllerIT to verify that the stats for total execution time (which includes the time taken to write indexing buffers) are collected and are indeed greater than just the indexing time alone. Please take a look when you get a chance. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for addressing the feedback, there're a couple of small things to tackle before we merge this 👍 .
.idea/eclipseCodeFormatter.xml
Outdated
@@ -1,14 +0,0 @@ | |||
<?xml version="1.0" encoding="UTF-8"?> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that this deletion was accidental? can we revert these changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had deleted the .idea directory from my elasticsearch repo to fix IntelliJ suddenly not recognizing any Lucene libraries, this is an effect of that. will fix it.
server/src/main/java/org/elasticsearch/index/shard/InternalIndexingStats.java
Outdated
Show resolved
Hide resolved
IndexService indexService = createIndex("index", indexSettings(1, 0).put("index.refresh_interval", -1).build()); | ||
IndexShard shard = indexService.getShard(0); | ||
for (int i = 0; i < 100; i++) { | ||
prepareIndex("index").setId(Integer.toString(i)).setSource("field", "value").get(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we don't need to set the id explicitly or at least we should add ids randomly, since org.elasticsearch.index.engine.InternalEngine#writeIndexingBuffer
takes into account the version map size too (which is populated when explicit ids are used).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh I see. Thanks!
public void testIndexingUpdatesRelevantStats() throws Exception { | ||
IndexService indexService = createIndex("index", indexSettings(1, 0).put("index.refresh_interval", -1).build()); | ||
IndexShard shard = indexService.getShard(0); | ||
for (int i = 0; i < 100; i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: maybe we can do this in a single bulk request?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we don't even need to index so many documents. The stat goes up in every request.
server/src/internalClusterTest/java/org/elasticsearch/indices/IndexingMemoryControllerIT.java
Outdated
Show resolved
Hide resolved
@fcofdez Should I mark this for backport ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. There's a pending comment about a method naming suggestion, but you can merge the PR once that's addressed. Thanks for all the iterations on this 👍
* @param took time it took to write the index buffers for this shard | ||
* @see org.elasticsearch.indices.IndexingMemoryController | ||
*/ | ||
public void writeIndexBuffersOnIndexThreads(long took) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we rename this method to addWriteIndexBuffersOnIndexThreadsTime
? its current naming is a bit confusing as it implies that it would do the write. Also, can we include the unit in the parameter method? i.e. tookInNanos
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you!
Seeks to address ES-11356.
This PR adds to the indexing write load, the time taken to flush write indexing buffers using the indexing threads (this is done here to push back on indexing)
This changes the semantics of
InternalIndexingStats#recentIndexMetric
andInternalIndexingStats#peakIndexMetric
to more accurately account for load on the indexing thread.