Enhance memory accounting for document expansion and introduce max document size limit#123543
Enhance memory accounting for document expansion and introduce max document size limit#123543fcofdez merged 14 commits intoelastic:mainfrom
Conversation
|
Pinging @elastic/es-distributed-indexing (Team:Distributed Indexing) |
|
Hi @fcofdez, I've created a changelog YAML for you. |
| private final AtomicLong lowWaterMarkSplits = new AtomicLong(0); | ||
| private final AtomicLong highWaterMarkSplits = new AtomicLong(0); | ||
|
|
||
| private final AtomicLong largeOpsRejections = new AtomicLong(0); |
There was a problem hiding this comment.
My idea is to use this specific metrics related to large documents / expansion issues in autoscaling, that way we could have an idea of the extra memory that the nodes would need to cope with the load.
…csearch into improve-memory-accounting
|
Warning It looks like this PR modifies one or more |
|
Warning It looks like this PR modifies one or more |
|
|
||
| public static final Setting<ByteSizeValue> MAX_OPERATION_SIZE = Setting.memorySizeSetting( | ||
| "indexing_pressure.memory.max_operation_size", | ||
| "5%", |
There was a problem hiding this comment.
This seems slightly breaking for small heaps, like 1GB heap now only allow 50MB docs. While this may be a good default, it could break some users too. Should we make it 10% here in the core code base for now?
Tim-Brooks
left a comment
There was a problem hiding this comment.
This mostly looks good. I do have a question about accounting operation counts twice.
| private final long lowWaterMarkSplits; | ||
| private final long highWaterMarkSplits; | ||
| private final long largeOpsRejections; | ||
| private final long totalLargeRejectedOpsBytes; |
There was a problem hiding this comment.
We haven't tracked the number of byte rejected in the past. I'm guessing that maybe we think this could be useful for autoscaling?
Like divide bytes rejected / ops to get an idea of what we need to scale to?
There was a problem hiding this comment.
Yes, that's the idea. But it's a bit tricky because we should make that value sticky somehow.
| } | ||
|
|
||
| public Releasable markPrimaryOperationStarted(int operations, long bytes, boolean forceExecution) { | ||
| public void checkLargestPrimaryOperationIsWithinLimits( |
There was a problem hiding this comment.
Any reason this should not be called from within markPrimaryOperationLocalToCoordinatingNodeStarted similar to validateAndMarkPrimaryOperationStarted?
There was a problem hiding this comment.
Not really, I added that method in f8b8814
| ) { | ||
| var listener = ActionListener.releaseBefore( | ||
| indexingPressure.trackPrimaryOperationExpansion( | ||
| primaryOperationCount(request), |
There was a problem hiding this comment.
Isn't think incrementing primary operations count a second time? I think we just want to do expansion memory here?
There was a problem hiding this comment.
We have to pass the number of operations to increment the number of rejected operations if the expansion is beyond the current limit. (there's an if to only increment the rejections in the method)
| private final AtomicLong lowWaterMarkSplits = new AtomicLong(0); | ||
| private final AtomicLong highWaterMarkSplits = new AtomicLong(0); | ||
|
|
||
| private final AtomicLong largeOpsRejections = new AtomicLong(0); |
| this.currentCombinedCoordinatingAndPrimaryBytes.getAndAdd(-bytes); | ||
| this.primaryRejections.getAndIncrement(); | ||
| this.primaryDocumentRejections.addAndGet(operations); | ||
| if (operationExpansionTracking) { |
There was a problem hiding this comment.
Hmm. Does this make sense? We've already pass the "large document" check. And this just means we passed the primary limit when attempting to do the expansion.
There was a problem hiding this comment.
I wasn't sure if we wanted to track expansions for autoscaling too, if you think that we shouldn't I can remove this.
There was a problem hiding this comment.
I kind of feel like if we get to this point and it is not a "large document" this should count as a primary rejection only as it might be just a normal sized document.
However, I'm open to changing this if there is a logical reason from an autoscaling perspective why we want to treat this.
Tim-Brooks
left a comment
There was a problem hiding this comment.
This looks good to me.
I made a comment about the large document vs. primary rejection. Although, I'm okay with either approach.
…cument size limit (elastic#123543) This commit improves memory accounting by incorporating document expansion during shard bulk execution. Additionally, it introduces a new limit on the maximum document size, which defaults to 5% of the available heap. This limit can be configured using the new setting: indexing_pressure.memory.max_operation_size These changes help prevent excessive memory consumption and improve indexing stability. Closes ES-10777
…cument size limit (elastic#123543) This commit improves memory accounting by incorporating document expansion during shard bulk execution. Additionally, it introduces a new limit on the maximum document size, which defaults to 5% of the available heap. This limit can be configured using the new setting: indexing_pressure.memory.max_operation_size These changes help prevent excessive memory consumption and improve indexing stability. Closes ES-10777
This commit improves memory accounting by incorporating document
expansion during shard bulk execution. Additionally, it introduces a new
limit on the maximum document size, which defaults to 5% of the
available heap.
This limit can be configured using the new setting:
These changes help prevent excessive memory consumption and
improve indexing stability.
Closes ES-10777