Deduplicate min and max term in single-term FieldReader#13618
Merged
original-brownbear merged 1 commit intoapache:mainfrom Jul 31, 2024
Merged
Conversation
I noticed that single-term readers are an edge case but not that uncommon in Elasticsearch heap dumps. It seems quite common to have a constant value for some field across a complete segment (e.g. a version value that is repeated endlessly in logs). Seems simple enough to deduplicate here to save a couple MB of heap.
jpountz
approved these changes
Jul 30, 2024
Contributor
jpountz
left a comment
There was a problem hiding this comment.
It feels like a corner case, but the change is simple enough. LGTM.
Member
Author
|
Thanks Adrien! |
original-brownbear
added a commit
that referenced
this pull request
Jul 31, 2024
I noticed that single-term readers are an edge case but not that uncommon in Elasticsearch heap dumps. It seems quite common to have a constant value for some field across a complete segment (e.g. a version value that is repeated endlessly in logs). Seems simple enough to deduplicate here to save a couple MB of heap.
original-brownbear
added a commit
to original-brownbear/lucene
that referenced
this pull request
Mar 10, 2025
Found this case in Elasticsearch heap dump's and it'as the same as apache#13618 but for BKDReader instances. Admittedly, as for terms this is a corner case but observed use cases where the distribution of these values is heavily weighted towards a single value would save up to a O(5M) in heap and some cache pressure from this change.
original-brownbear
added a commit
to original-brownbear/lucene
that referenced
this pull request
Mar 10, 2025
Found this case in Elasticsearch heap dump's and it'as the same as apache#13618 but for BKDReader instances. Admittedly, as for terms this is a corner case but observed use cases where the distribution of these values is heavily weighted towards a single value would save up to a O(5M) in heap and some cache pressure from this change.
original-brownbear
added a commit
that referenced
this pull request
Mar 10, 2025
Found this case in Elasticsearch heap dump's and it'as the same as #13618 but for BKDReader instances. Admittedly, as for terms this is a corner case but observed use cases where the distribution of these values is heavily weighted towards a single value would save up to a O(5M) in heap and some cache pressure from this change.
original-brownbear
added a commit
that referenced
this pull request
Mar 10, 2025
Found this case in Elasticsearch heap dump's and it'as the same as #13618 but for BKDReader instances. Admittedly, as for terms this is a corner case but observed use cases where the distribution of these values is heavily weighted towards a single value would save up to a O(5M) in heap and some cache pressure from this change.
hanbj
pushed a commit
to hanbj/lucene
that referenced
this pull request
Mar 12, 2025
Found this case in Elasticsearch heap dump's and it'as the same as apache#13618 but for BKDReader instances. Admittedly, as for terms this is a corner case but observed use cases where the distribution of these values is heavily weighted towards a single value would save up to a O(5M) in heap and some cache pressure from this change.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed that single-term readers are an edge case but not that uncommon in Elasticsearch heap dumps. It seems quite common to have a constant value for some field across a complete segment (e.g. a version value that is repeated endlessly in logs).
Seems simple enough to deduplicate here to save a couple MB of heap, though it's admittedly an edge case that mostly matters for large segment counts.