Solving performance problems in parallel processing#259
Merged
domesticmouse merged 2 commits intogooglemaps:masterfrom Apr 12, 2017
Merged
Solving performance problems in parallel processing#259domesticmouse merged 2 commits intogooglemaps:masterfrom
domesticmouse merged 2 commits intogooglemaps:masterfrom
Conversation
domesticmouse
approved these changes
Apr 12, 2017
Contributor
Author
|
Nice. @domesticmouse you have an idea when we will have a new release ? |
Contributor
|
Release is now in the wild. v0.1.20 is up on search.maven.org. |
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.
Hi.
In this patch, I first adjusted the problem described in issue #256.
But even after this, I did some testing and the parallel performance was still much lower than expected (set in GeoApiContextProvider.setQueryRateLimit)
After a few more tests, I identified that the problem was in the delay between take operations in RateLimitExecutorService.
The ThreadPoolExecutor documentation, explains the overhead of using the LinkedBlockingQueue as workQueue and suggests the use of SynchronousQueue as a good choice.
To my surprise, when I tested only this change I had incredible results.
I used the example cited by @irineuruiz in #228 with litle changes to perform the test with 500 tries and 50 QPS.
Using LinkedBlockingQueue:
Time taken: 22248
QPS achieved: 22.473930240920534
Using SynchronousQueue:
Time taken: 11467
QPS achieved: 43.60338362256911
Also, I checked that by default the OkHttp Dispatcher uses SynchronousQueue to run. So I think it's a pretty safe change.
This patch fixes #256 and #228 issues and will allows us to achiev the expected QPS.