-
Notifications
You must be signed in to change notification settings - Fork 566
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
New implementation of WorkQueue that allows concurrent enqueuing of tasks #2859
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…asks. Previous implementation was based on LinkedBlockingQueue which uses a lock to prevent concurrent additions to the queue. Under high concurrency, this effectively introduces a "chicane" that results in a lot of threads waiting and a poor CPU utilization. The new implementation uses a ConcurrentLinkedQueue and two semaphores to enable concurrent enqueuing of tasks. The poor CPU utilization was discovered while running DBClient tests that used a ThreadPool to execute blocking calls. Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
ljnelson
reviewed
Mar 12, 2021
common/configurable/src/main/java/io/helidon/common/configurable/ThreadPool.java
Outdated
Show resolved
Hide resolved
ljnelson
reviewed
Mar 12, 2021
common/configurable/src/main/java/io/helidon/common/configurable/ThreadPool.java
Show resolved
Hide resolved
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
ljnelson
previously approved these changes
Mar 12, 2021
Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
spericas
force-pushed
the
threadpool-optimization
branch
from
March 12, 2021 19:36
d7cc69d
to
e48b6e4
Compare
olotenko
suggested changes
Mar 15, 2021
common/configurable/src/main/java/io/helidon/common/configurable/ThreadPool.java
Outdated
Show resolved
Hide resolved
common/configurable/src/main/java/io/helidon/common/configurable/ThreadPool.java
Outdated
Show resolved
Hide resolved
…ainTo(). Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
olotenko
approved these changes
Mar 15, 2021
ljnelson
approved these changes
Mar 15, 2021
paulparkinson
pushed a commit
that referenced
this pull request
Mar 29, 2021
…asks (#2859) * New implementation of WorkQueue that allows concurrent enqueuing of tasks. Previous implementation was based on LinkedBlockingQueue which uses a lock to prevent concurrent additions to the queue. Under high concurrency, this effectively introduces a "chicane" that results in a lot of threads waiting and a poor CPU utilization. The new implementation uses a ConcurrentLinkedQueue and two semaphores to enable concurrent enqueuing of tasks. The poor CPU utilization was discovered while running DBClient tests that used a ThreadPool to execute blocking calls. Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com> * Use try-finally when calling enqueue(task). Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com> * Fixed unnecessary formatting. Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com> * Moved try-block logic into enqueue() method. New implementation of drainTo(). Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
aseovic
pushed a commit
to aseovic/helidon
that referenced
this pull request
Apr 26, 2021
…asks (helidon-io#2859) * New implementation of WorkQueue that allows concurrent enqueuing of tasks. Previous implementation was based on LinkedBlockingQueue which uses a lock to prevent concurrent additions to the queue. Under high concurrency, this effectively introduces a "chicane" that results in a lot of threads waiting and a poor CPU utilization. The new implementation uses a ConcurrentLinkedQueue and two semaphores to enable concurrent enqueuing of tasks. The poor CPU utilization was discovered while running DBClient tests that used a ThreadPool to execute blocking calls. Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com> * Use try-finally when calling enqueue(task). Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com> * Fixed unnecessary formatting. Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com> * Moved try-block logic into enqueue() method. New implementation of drainTo(). Signed-off-by: Santiago Pericasgeertsen <santiago.pericasgeertsen@oracle.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
New implementation of
WorkQueue
that allows concurrent enqueuing of tasks. Previous implementation was based onLinkedBlockingQueue
which uses a lock to prevent concurrent additions to the queue. Under high concurrency, this effectively introduces a "chicane" that results in a lot of threads waiting and a poor CPU utilization. The new implementation uses aConcurrentLinkedQueue
and two semaphores to enable concurrent enqueuing of tasks. The poor CPU utilization was discovered while running DBClient tests that used a ThreadPool to execute blocking calls. Credit to @olotenko.Signed-off-by: Santiago Pericasgeertsen santiago.pericasgeertsen@oracle.com