Skip to content
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

Merged
merged 2 commits into from
Jul 25, 2023
Merged

feat: Add a load generator to the examples #304

merged 2 commits into from
Jul 25, 2023

Conversation

nand4011
Copy link
Contributor

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.

@@ -19,9 +19,14 @@ repositories {
dependencies {
implementation("software.momento.java:sdk:1.0.0")

implementation("com.google.guava:guava:31.1-android")
Copy link
Contributor Author

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.
Copy link
Contributor

@pratik151192 pratik151192 left a 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);
Copy link
Contributor

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?

Copy link
Contributor Author

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.
@nand4011 nand4011 merged commit 8a8ffd6 into main Jul 25, 2023
5 checks passed
@nand4011 nand4011 deleted the loadgen branch July 25, 2023 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants