Skip to content
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

ARTEMIS-4522 Dedicated thread pool for flow-control-executor #4699

Closed
wants to merge 1 commit into from

Conversation

MrEasy
Copy link
Contributor

@MrEasy MrEasy commented Dec 1, 2023

Adds a dedicated thread pool for flow-control-executor to resolve slow-consumer-handling not being able to run in good time if common thread-pool is exhausted

threadPool = ActiveMQClient.getGlobalThreadPool();

flowControlPool = ActiveMQClient.getFlowControlThreadPool(); //TODO add option for config
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any help/comment rg. this would be good - or deemed unneccessary?

@clebertsuconic
Copy link
Contributor

clebertsuconic commented Dec 1, 2023

If you set a smaller thread pool you could get other issues...

you fixed one case by adding a new thread pool for flow control.

When you hit another feature not working because the thread pool is saturated, are you going to add another pool to that feature also?

Having a warn that the pool is saturated and suggestion to increase would probably be a better feature IMO.

@MrEasy
Copy link
Contributor Author

MrEasy commented Dec 1, 2023

Hi,

When you hit another feature not working because the thread pool is saturated, are you going to add another pool to that feature also?

If you reach the configured limit, I think everyone is clear that you will get delays until resources are freed. Our goal here was to address the issue that was more unexpected to us, which lead to the big 10 seconds delays based on the flow-control explicitly.
You could argue, that if going into slow-consumer-handling is not aiming for highest throughput anyhow, but having consumer-window-size>0 this has another disadvantage for us (see lengthy explanatin by Sascha in slack).
So goal for us here was to stick to the slow-consumer-handling, but avoiding the big 10 seconds influence of the full pool on it.

Having a warn that the pool is saturated and suggestion to increase would probably be a better feature IMO.

I think that would also be an excellent improvement, since now it is not easily visible when the client thread-pool reaches its limit.

@jbertram
Copy link
Contributor

jbertram commented Dec 4, 2023

I've talked with @MrEasy (and one of his colleague's) in Slack about his use-case. This solution seems reasonable to me. If you want to constrain the "normal" thread pool but still ensure that flow-control works without extreme latency then we need something like this.

In the future we could probably ditch these kinds of things using Virtual Threads.

@jbertram
Copy link
Contributor

jbertram commented Dec 4, 2023

@MrEasy, you've got a handful of checkstyle violations:

[INFO] There are 8 errors reported by Checkstyle 10.11.0 with /home/runner/work/activemq-artemis/activemq-artemis/artemis-core-client/../etc/checkstyle.xml ruleset.
Error:  src/main/java/org/apache/activemq/artemis/core/client/impl/ClientSessionFactoryImpl.java:[196,4] (blocks) LeftCurly: '{' at column 4 should be on the previous line.
Error:  src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java:[194,4] (blocks) LeftCurly: '{' at column 4 should be on the previous line.
Error:  src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java:[197,7] (blocks) RightCurly: '}' at column 7 should be on the same line as the next part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else, do/while or try/catch/finally).
Error:  src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java:[204,7] (blocks) RightCurly: '}' at column 7 should be on the same line as the next part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else, do/while or try/catch/finally).
Error:  src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java:[209,10] (blocks) LeftCurly: '{' at column 10 should be on the previous line.
Error:  src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java:[212,13] (blocks) LeftCurly: '{' at column 13 should be on the previous line.
Error:  src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java:[220,10] (blocks) RightCurly: '}' at column 10 should be on the same line as the next part of a multi-block statement (one that directly contains multiple blocks: if/else-if/else, do/while or try/catch/finally).
Error:  src/main/java/org/apache/activemq/artemis/core/client/impl/ServerLocatorImpl.java:[228,13] (blocks) LeftCurly: '{' at column 13 should be on the previous line.

You can check this yourself locally if you want via:

mvn -Pdev install

See the hacking guide for more details.

Also, your commits should be squashed.

@MrEasy
Copy link
Contributor Author

MrEasy commented Dec 5, 2023

MrEasy, you've got a handful of checkstyle violations:
...
Also, your commits should be squashed.

Reduced violence and squashed

@jbertram jbertram mentioned this pull request Dec 7, 2023
@jbertram
Copy link
Contributor

jbertram commented Dec 7, 2023

@MrEasy, I followed-up on this with #4708. The new PR has an additional commit which drastically simplifies the test and finishes the implementation with configuration properties, etc.

@jbertram jbertram closed this Dec 8, 2023
@MrEasy MrEasy deleted the ARTEMIS-4522 branch December 11, 2023 12:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants