-
Notifications
You must be signed in to change notification settings - Fork 5
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
feat: Prototype for concurrent operations limiting #385
Conversation
Modify cache Get and Get to add optional concurrent operations limiting. It works by creating an executor with a max number of threads equal to the limit. Get and Set calls are given to the executor and wait on the executor's internal queue until there is a thread free to take them, implicitly limiting the number of concurrent requests. Add a general ScsFutureStub method that takes a gRPC call, a gRPC to Momento response converter, and an error handler. Something like this should let us cut a lot of boilerplate out of the data client. It won't work for the batch call, since that uses a different type of stub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall this looks like a promising pattern.
Can you update the PR description to leave a few notes on what you observed the behavior of the loadgen program to be like, if you configure the loadgen to do like 10k concurrent requests and then run it wthout this setting vs. running with this setting set to like 100 or 200?
And then also outline how much work you think would be left to bring this over the finish line.
@@ -3716,4 +3724,34 @@ private _DictionaryDeleteRequest.Some addSomeFieldsToRemove(@Nonnull List<ByteSt | |||
public void close() { | |||
scsDataGrpcStubsManager.close(); | |||
} | |||
|
|||
public static void main(String[] args) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i presume this was just for dev and would be removed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It was. I left it in just to show a more simple example of how the thread pool limits the concurrent requests.
@@ -11,6 +12,8 @@ public class Configuration { | |||
private final TransportStrategy transportStrategy; | |||
private final RetryStrategy retryStrategy; | |||
|
|||
private final Integer concurrencyLimit; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we decide to push forward with this we should spend a minute thinking about whether this should be a top-level config setting or if it belongs on one of the inner objects. i don't have an opinion yet, just want to be deliberate about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed.
I'm setting up another test run with the load generator to get more results. As for next steps:
|
I did a few runs of the Java load generator set to 5,000tps against a cache with a limit of 10,000tps. I ran it on a c6i.4xl. The concurrent request limit of the load generator was set to 10,000. Each run was 120 seconds.
Client concurrent requests limited to 100, using a ForkJoinPool:
Client concurrent requests limited to 100, using a FixedThreadPool:
The biggest change is the lack of timeout errors on startup when using the client request limiting. Next is the difference in max read time between the ForkJoinPool and the FixedThreadPool. Thread creation is expensive, but I wouldn't expect it to be that expensive. |
sorry for leaving this hanging for so long. the results you posted look good to me, I just had one question about a few of your statements:
I'm not 100% sure which you set to 5k and which to 10k; I'm assuming:
In the output you show under that ^^, there are lots of timeouts (as I'd expect). Then right after it you show the results with turning the CacheClient limiter down to much smaller/more reasonable values, and no more timeouts. Also as I'd hope/expect. Then you say this:
That part I'm not following. You don't have any data above for what happens if you do: load gen code 5k or 10k, CacheClient limiter disabled. |
Modify cache Get and Get to add optional concurrent operations limiting. It works by creating an executor with a max number of threads equal to the limit. Get and Set calls are given to the executor and wait on the executor's internal queue until there is a thread free to take them, implicitly limiting the number of concurrent requests. The load generator limits concurrent requests in the same way.
Add a general ScsFutureStub method that takes a gRPC call, a gRPC to Momento response converter, and an error handler. Something like this should let us cut a lot of boilerplate out of the data client. It won't work for the batch call, since that uses a different type of stub.