OpenSearch
OpenSearch copied to clipboard
[Weighted Shard Routing] Revisit weighted routing cache
Describe the solution you'd like
Revisit WeightedRoutingCache and see if we can make it more optimal. Currently the cache is invalidated on every cluster state change which is not needed and can affect performance.
- Check if we can leverage
AttributeRoutingswhich is invalidated only on change in shard routing.
static class AttributesRoutings {
public final List<ShardRouting> withSameAttribute;
public final List<ShardRouting> withoutSameAttribute;
public final int totalSize;
AttributesRoutings(List<ShardRouting> withSameAttribute, List<ShardRouting> withoutSameAttribute) {
this.withSameAttribute = withSameAttribute;
this.withoutSameAttribute = withoutSameAttribute;
this.totalSize = withoutSameAttribute.size() + withSameAttribute.size();
}
}
- Make
WeightedRoutingCachemore performant.
https://github.com/opensearch-project/OpenSearch/pull/4241#discussion_r971681349 https://github.com/opensearch-project/OpenSearch/pull/4241#discussion_r971684094
Closing this issue. This is fixed in 4241