-
Notifications
You must be signed in to change notification settings - Fork 3.9k
[ClusterPipeline] ExecutorService/thread is created and destroyed too frequently in ClusterPipeline #4141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Thanks for reporting it. Multiple sources have raised this valid concern. |
@ggivo thank you, and by the way
is it should use computeIfAbsent? instead of putIfAbsent. pipelinedResponses.putIfAbsent(nodeKey, new LinkedList<>());
queue = pipelinedResponses.get(nodeKey);
->
queue = pipelinedResponses.computeIfAbsent(nodeKey, (_) -> new LinkedList<>())
|
Do you have anything particular in mind? |
Because each putIfAbsent will create a list object, but if the key already exists in the map, this list doesn't need to be created. |
From a performance optimization perspective, I think there is not much of a difference, since we will execute The current implementation of |
@ggivo Yes, You're right. we can just even use put. because we checked it not contains. |
And if and we can run the last If you think so, I'd like to create a PR. |
@xrayw Note: Since it does not address the main concern described in this Issue, I suggest opening a dedicated Issue to track this optimization. |
Thank you ,i createed a new issue to track it. #4148 |
The code at here
jedis/src/main/java/redis/clients/jedis/MultiNodePipelineBase.java
Line 88 in 1d1b268
It will create a ExecutorService for each pipeline sync, This will cause huge cost when there are many pipeline operations
The text was updated successfully, but these errors were encountered: