Pre-check

  • [x] I am sure that all the content I provide is in English.

Search before asking

  • [x] I had searched in the issues and found no similar issues.

Apache Dubbo Component

Java SDK (apache/dubbo)

Dubbo Version

dubbo version: every version

Steps to reproduce this issue

https://github.com/apache/dubbo/blob/3.3/dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/ConsistentHashLoadBalance.java

ConsistentHashSelector<T> selector = (ConsistentHashSelector<T>) selectors.get(key);
if (selector == null || selector.identityHashCode != invokersHashCode) {
    selectors.put(key, new ConsistentHashSelector<T>(invokers, methodName, invokersHashCode));
    selector = (ConsistentHashSelector<T>) selectors.get(key);
}

Under high concurrency, the consistent hashing load balancing algorithm frequently creates new ConsistentHashSelector instances, resulting in excessive hash and MD5 computations. This leads to high CPU load and negatively impacts overall service performance.

What you expected to happen

We hope to reduce the frequency of creating new ConsistentHashSelector instances. Under high concurrency, only one thread needs to execute the ConsistentHashSelector logic, while the other threads can directly use the computed result.

Anything else

No response

Are you willing to submit a pull request to fix on your own?

  • [x] Yes I am willing to submit a pull request on my own!

Code of Conduct