-
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: Add a load generator to the examples #304
Conversation
@@ -19,9 +19,14 @@ repositories { | |||
dependencies { | |||
implementation("software.momento.java:sdk:1.0.0") | |||
|
|||
implementation("com.google.guava:guava:31.1-android") |
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.
This is the version of guava transitively pulled in by our protos.
Add a load generator example in the style of load generators we've made for other SDKs. It schedules a configurable number of alternating write and read tasks, limiting the total tps using a Guava RateLimiter.
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.
Just had 1 comment otherwise LGTM
} else if (response instanceof GetResponse.Error error) { | ||
handleErrorResponse(error.getErrorCode()); | ||
} | ||
scheduleSet(workerId, nextOperationNum); |
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.
This looks like unintended else we'll be in an infinite loop of set-get-set?
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.
That is intended. It schedules alternating write and read tasks that reschedule themselves forever. The throughput is controlled by the rate limiter blocking when the tasks run too quickly. It is broken by the shutdown method that the main method calls at the end of the benchmark.
times that occur when starting. Switch time measurement to nanoTime because millis didn't give enough resolution.
Add a load generator example in the style of load generators we've made for other SDKs. It schedules a configurable number of alternating write and read tasks, limiting the total tps using a Guava RateLimiter.