Optimization: Async cleanup of connections before pooling#48
Draft
jduo wants to merge 4 commits intovalkey-io:mainfrom
Draft
Optimization: Async cleanup of connections before pooling#48jduo wants to merge 4 commits intovalkey-io:mainfrom
jduo wants to merge 4 commits intovalkey-io:mainfrom
Conversation
Only send UNWATCH requests when returning a connection to the pool if there have actually been watched keys. Signed-off-by: James Duong <duong.james@gmail.com>
Signed-off-by: James Duong <duong.james@gmail.com>
Always issue UNWATCH requests before submitting a connection back to the pool for reuse, but asynchronously wait for the request to complete instead of blocking the application thread. Also cleanup some of the type to use BaseClient instead of Object. Signed-off-by: James Duong <duong.james@gmail.com>
Author
|
This yielded about a 1.75x performance improvement compared to the un-optimized version when testing with the benchmark and server running locally. It would yield a greater benefit if real network is involved since this lets us do work while a network roundtrip is happening rather than just waiting. |
Signed-off-by: James Duong <duong.james@gmail.com>
This file contains hidden or 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
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.
Rework the connection state clean-up to happen asynchronously instead of blocking the application thread.
This provides similar performance benefits to skipping the UNWATCH entirely, but is safer due to not
changing the semantics and also more applicable to scenarios where there actually are WATCHed keys.