Skip to content

Commit

Permalink
chore(benchmarking): Change bidi workload to be write only and pass b…
Browse files Browse the repository at this point in the history
…idi flag (#2468)
  • Loading branch information
sydney-munro authored Mar 26, 2024
1 parent c608100 commit 55ec75f
Showing 1 changed file with 23 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ public final class StorageSharedBenchmarkingCli implements Runnable {
defaultValue = "0")
int warmup;

@Option(names = "-bidi", description = "If bidi should be enabled")
boolean bidiEnabled;

Path tempDir;

PrintWriter printWriter;
Expand All @@ -107,11 +110,8 @@ public void run() {
case "w1r3":
runWorkload1();
break;
case "bidi":
runWorkloadBidi();
break;
case "default-nobidi":
runWorkloadNoBidi();
case "write-only":
runWorkloadWriteOnly();
break;
default:
throw new IllegalStateException("Specify a workload to run");
Expand Down Expand Up @@ -158,36 +158,31 @@ private void runWorkload1DirectPath() {
}
}

private void runWorkloadBidi() {
StorageOptions options =
StorageOptions.grpc()
.setProjectId(project)
.setBlobWriteSessionConfig(BlobWriteSessionConfigs.bidiWrite())
.build();
Storage storageClient = options.getService();
private void runWorkloadWriteOnly() {
try {
runBidi(storageClient);
if (bidiEnabled) {
StorageOptions options =
StorageOptions.grpc()
.setProjectId(project)
.setBlobWriteSessionConfig(BlobWriteSessionConfigs.bidiWrite())
.build();
Storage storageClient = options.getService();
runBidi(storageClient);
} else {
StorageOptions options =
StorageOptions.grpc()
.setProjectId(project)
.setBlobWriteSessionConfig(BlobWriteSessionConfigs.getDefault())
.build();
Storage storageClient = options.getService();
runBidi(storageClient);
}
} catch (Exception e) {
System.err.println("Failed to run workload bidi" + e.getMessage());
System.exit(1);
}
}

private void runWorkloadNoBidi() {
StorageOptions options =
StorageOptions.grpc()
.setProjectId(project)
.setBlobWriteSessionConfig(BlobWriteSessionConfigs.getDefault())
.build();
Storage storageClient = options.getService();
try {
runBidi(storageClient);
} catch (Exception e) {
System.err.println("Failed to run workload no bidi" + e.getMessage());
System.exit(1);
}
}

private void runW1R3(Storage storageClient) throws ExecutionException, InterruptedException {
ListeningExecutorService executorService =
MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(workers));
Expand Down

0 comments on commit 55ec75f

Please sign in to comment.