From 681d36056267e9afc4c7ec1ffe17c6e49d7b1344 Mon Sep 17 00:00:00 2001 From: Andrew Carbonetto Date: Tue, 20 Aug 2024 10:24:50 -0700 Subject: [PATCH] Java: Fix benchmarkApp to support port (#2170) * Java: Add port and examples for benchmark app Signed-off-by: Andrew Carbonetto --- java/README.md | 10 ++++++++++ .../main/java/glide/benchmarks/BenchmarkingApp.java | 4 ++++ 2 files changed, 14 insertions(+) diff --git a/java/README.md b/java/README.md index 3c1a8cbe1d..9b14dab87d 100644 --- a/java/README.md +++ b/java/README.md @@ -271,11 +271,21 @@ For more examples, you can refer to the test folder [unit tests](./client/src/te You can run benchmarks using `./gradlew run`. You can set arguments using the args flag like: +Returns the command help output ```shell ./gradlew run --args="--help" +``` + +Runs all benchmark clients against a local instance with TLS enabled using data sizing 100 and 1000 bytes, 10 and 100 concurrent tasks, 1 and 5 parallel clients. +```shell ./gradlew run --args="--resultsFile=output --dataSize \"100 1000\" --concurrentTasks \"10 100\" --clients all --host localhost --port 6279 --clientCount \"1 5\" --tls" ``` +Runs GLIDE client against a local cluster instance on port 52756 using data sizing 4000 bytes, and 1000 concurrent tasks. +```shell +./gradlew run --args="--resultsFile=output --dataSize \"4000\" --concurrentTasks \"1000\" --clients glide --host 127.0.0.1 --port 52746 --clusterModeEnabled" +``` + The following arguments are accepted: * `resultsFile`: the results output file * `concurrentTasks`: number of concurrent tasks diff --git a/java/benchmarks/src/main/java/glide/benchmarks/BenchmarkingApp.java b/java/benchmarks/src/main/java/glide/benchmarks/BenchmarkingApp.java index 31ab7bbd13..7f7f2de254 100644 --- a/java/benchmarks/src/main/java/glide/benchmarks/BenchmarkingApp.java +++ b/java/benchmarks/src/main/java/glide/benchmarks/BenchmarkingApp.java @@ -176,6 +176,10 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce runConfiguration.host = line.getOptionValue("host"); } + if (line.hasOption("port")) { + runConfiguration.port = Integer.parseInt(line.getOptionValue("port")); + } + if (line.hasOption("clientCount")) { runConfiguration.clientCount = parseIntListOption(line.getOptionValue("clientCount")); }