Carry over version map size to prevent excessive resizing#27516
Merged
s1monw merged 1 commit intoelastic:masterfrom Nov 24, 2017
Merged
Carry over version map size to prevent excessive resizing#27516s1monw merged 1 commit intoelastic:masterfrom
s1monw merged 1 commit intoelastic:masterfrom
Conversation
Today we create a new concurrent hash map everytime we refresh the internal reader. Under defaults this isn't much of a deal but once the refresh interval is set to `-1` these maps grow quite large and it can have a significant impact on indexing throughput. Under low memory situations this can cause up to 2x slowdown. This change carries over the map size as the initial capacity wich will be auto-adjusted once indexing stops.
Contributor
Author
|
here is a benchmark that I ran with and without the change and note: baseline is with the change |
danielmitterdorfer
approved these changes
Nov 24, 2017
Member
danielmitterdorfer
left a comment
There was a problem hiding this comment.
Great finding! I left one minor comment but LGTM.
| // reopen, and so any concurrent indexing requests can still sneak in a few additions to that current map that are in fact reflected | ||
| // in the previous reader. We don't touch tombstones here: they expire on their own index.gc_deletes timeframe: | ||
| maps = new Maps(maps.current, ConcurrentCollections.<BytesRef,VersionValue>newConcurrentMapWithAggressiveConcurrency()); | ||
| maps = new Maps(maps.current, Collections.emptyMap()); |
Member
There was a problem hiding this comment.
I'm probably lacking the larger context here but is it ok to change the implementation class from ConcurrentHashMap to HashMap here?
Contributor
Author
There was a problem hiding this comment.
yeah it's an immutable map and we should never ever modify it too.
Contributor
Author
Contributor
|
Agreed it does. |
s1monw
added a commit
that referenced
this pull request
Nov 24, 2017
Today we create a new concurrent hash map everytime we refresh the internal reader. Under defaults this isn't much of a deal but once the refresh interval is set to `-1` these maps grow quite large and it can have a significant impact on indexing throughput. Under low memory situations this can cause up to 2x slowdown. This change carries over the map size as the initial capacity wich will be auto-adjusted once indexing stops. Closes #20498
s1monw
added a commit
that referenced
this pull request
Nov 24, 2017
Today we create a new concurrent hash map everytime we refresh the internal reader. Under defaults this isn't much of a deal but once the refresh interval is set to `-1` these maps grow quite large and it can have a significant impact on indexing throughput. Under low memory situations this can cause up to 2x slowdown. This change carries over the map size as the initial capacity wich will be auto-adjusted once indexing stops. Closes #20498
s1monw
added a commit
that referenced
this pull request
Nov 24, 2017
Today we create a new concurrent hash map everytime we refresh the internal reader. Under defaults this isn't much of a deal but once the refresh interval is set to `-1` these maps grow quite large and it can have a significant impact on indexing throughput. Under low memory situations this can cause up to 2x slowdown. This change carries over the map size as the initial capacity wich will be auto-adjusted once indexing stops. Closes #20498
s1monw
added a commit
that referenced
this pull request
Nov 24, 2017
Today we create a new concurrent hash map everytime we refresh the internal reader. Under defaults this isn't much of a deal but once the refresh interval is set to `-1` these maps grow quite large and it can have a significant impact on indexing throughput. Under low memory situations this can cause up to 2x slowdown. This change carries over the map size as the initial capacity wich will be auto-adjusted once indexing stops. Closes #20498
martijnvg
added a commit
that referenced
this pull request
Nov 24, 2017
* es/master: (38 commits) Backport wait_for_initialiazing_shards to cluster health API Carry over version map size to prevent excessive resizing (#27516) Fix scroll query with a sort that is a prefix of the index sort (#27498) Delete shard store files before restoring a snapshot (#27476) Replace `delimited_payload_filter` by `delimited_payload` (#26625) CURRENT should not be a -SNAPSHOT version if build.snapshot is false (#27512) Fix merging of _meta field (#27352) Remove unused method (#27508) unmuted test, this has been fixed by #27397 Consolidate version numbering semantics (#27397) Add wait_for_no_initializing_shards to cluster health API (#27489) [TEST] use routing partition size based on the max routing shards of the second split Adjust CombinedDeletionPolicy for multiple commits (#27456) Update composite-aggregation.asciidoc Deprecate `levenstein` in favor of `levenshtein` (#27409) Automatically prepare indices for splitting (#27451) Validate `op_type` for `_create` (#27483) Minor ShapeBuilder cleanup muted test Decouple nio constructs from the tcp transport (#27484) ...
martijnvg
added a commit
that referenced
this pull request
Nov 24, 2017
* es/6.x: (30 commits) Add wait_for_no_initializing_shards to cluster health API (#27489) Carry over version map size to prevent excessive resizing (#27516) Fix scroll query with a sort that is a prefix of the index sort (#27498) Delete shard store files before restoring a snapshot (#27476) CURRENT should not be a -SNAPSHOT version if build.snapshot is false (#27512) Fix merging of _meta field (#27352) test: do not run percolator query builder bwc test against 5.x versions Remove unused method (#27508) Consolidate version numbering semantics (#27397) Adjust CombinedDeletionPolicy for multiple commits (#27456) Minor ShapeBuilder cleanup [GEO] Deprecate ShapeBuilders and decouple geojson parse logic Improve docs for split API in 6.1/6.x (#27504) test: use correct pre 6.0.0-alpha1 format Update composite-aggregation.asciidoc Deprecate `levenstein` in favor of `levenshtein` (#27409) Decouple nio constructs from the tcp transport (#27484) Bump version from 6.1 to 6.2 Fix whitespace in Security.java Tighten which classes can exit ...
Contributor
|
This is great. I wonder if we should reset the map during synced flush to make sure we free resources when we go idle (there are other options, but I think this is the simplest). |
s1monw
added a commit
to s1monw/elasticsearch
that referenced
this pull request
Nov 27, 2017
Today we carry on the size of the live version map to ensure that we minimze rehashing. Yet, once we are idle or we can issue a sync-commit we can resize it to defaults to free up memory. Relates to elastic#27516
Contributor
Author
s1monw
added a commit
that referenced
this pull request
Nov 30, 2017
Today we carry on the size of the live version map to ensure that we minimze rehashing. Yet, once we are idle or we can issue a sync-commit we can resize it to defaults to free up memory. Relates to #27516
s1monw
added a commit
that referenced
this pull request
Nov 30, 2017
Today we carry on the size of the live version map to ensure that we minimze rehashing. Yet, once we are idle or we can issue a sync-commit we can resize it to defaults to free up memory. Relates to #27516
s1monw
added a commit
that referenced
this pull request
Nov 30, 2017
Today we carry on the size of the live version map to ensure that we minimze rehashing. Yet, once we are idle or we can issue a sync-commit we can resize it to defaults to free up memory. Relates to #27516
s1monw
added a commit
that referenced
this pull request
Nov 30, 2017
Today we carry on the size of the live version map to ensure that we minimze rehashing. Yet, once we are idle or we can issue a sync-commit we can resize it to defaults to free up memory. Relates to #27516
s1monw
added a commit
that referenced
this pull request
Nov 30, 2017
Today we carry on the size of the live version map to ensure that we minimze rehashing. Yet, once we are idle or we can issue a sync-commit we can resize it to defaults to free up memory. Relates to #27516
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.
Today we create a new concurrent hash map everytime we refresh
the internal reader. Under defaults this isn't much of a deal but
once the refresh interval is set to
-1these maps grow quite largeand it can have a significant impact on indexing throughput. Under low
memory situations this can cause up to 2x slowdown. This change carries
over the map size as the initial capacity wich will be auto-adjusted once
indexing stops.
Closes #20498