Make ClusterInfo use immutable maps in all cases#88447
Make ClusterInfo use immutable maps in all cases#88447original-brownbear merged 5 commits intoelastic:masterfrom original-brownbear:faster-cluster-info
Conversation
This class's maps are used very hot in the disk threshold allocation decider. Moving them from hppc maps to unmodifiable map wrapping `HashMap` has led to a measurable slowdown in the many-shards benchmark bootstrapping. Lets use immutable map copies here exclusively to make performance outright better and more predictable via a single implementation.
|
Pinging @elastic/es-distributed (Team:Distributed) |
|
Jenkins run elasticsearch-ci/part-2 (unrelated) |
| Map.copyOf(shardSizeByIdentifierBuilder), | ||
| Map.copyOf(shardDataSetSizeBuilder), | ||
| Map.copyOf(dataPathByShardRoutingBuilder), | ||
| Map.copyOf(rsrvdSpace) |
There was a problem hiding this comment.
Since the type of the map is critical, would it be better to move this inside of the constructor so that it is impossible to create the object with wrong (slower) map implementation?
There was a problem hiding this comment.
Yea I thought about this but then I figured there's only this one spot that we actually do a real instantiation of this thing and it's private so it's probably not necessary to add extra verbosity.
|
Thanks Ievgen! |
* upstream/master: Pass IndexMetadata to AllocationDecider.can_remain (elastic#88453) [TSDB] Cache rollup bucket timestamp to reduce rounding cost (elastic#88420) Correct some typos/mistakes in comments/docs (elastic#88446) Make ClusterInfo use immutable maps in all cases (elastic#88447) Reduce map lookups (elastic#88418) Don't index geo_shape field in AbstractBuilderTestCase (elastic#88437) Remove usages of TestGeoShapeFieldMapperPlugin from enrich module (elastic#88440) Fix test memory leak (elastic#88362) Improve error when sorting on incompatible types (elastic#88399) Remove usages of BucketCollector#getLeafCollector(LeafReaderContext) (elastic#88414) Mute ReactiveStorageIT::testScaleWhileShrinking (elastic#88431) Clarify snapshot docs on archive indices (elastic#88417) [Stack Monitoring] Switch cgroup memory fields to keyword (elastic#88260) Fix RealmIdentifier XContent parser (elastic#88410) Make LoggedExec gradle task configuration cache compatible (elastic#87621) Update CorruptedFileIT so that it passes with new allocation strategy (elastic#88314) Update RareClusterStateIT to work with the new shards allocator (elastic#87922) Ensure CreateApiKey always creates a new document (elastic#88413) # Conflicts: # x-pack/plugin/rollup/src/main/java/org/elasticsearch/xpack/rollup/v2/RollupShardIndexer.java
@original-brownbear |
This class's maps are used very hot in the disk threshold allocation
decider. Moving them from hppc maps to unmodifiable map wrapping
HashMaphas led to a measurable slowdown in the many-shards benchmarkbootstrapping. Lets use immutable map copies here exclusively to make
performance outright better and more predictable via a single implementation.
relates #77466