Skip to content

Commit

Permalink
update commandline defaults for review comments
Browse files Browse the repository at this point in the history
Signed-off-by: acarbonetto <[email protected]>
  • Loading branch information
acarbonetto committed Oct 11, 2023
1 parent 0bf1678 commit 12efc63
Showing 1 changed file with 40 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import org.apache.commons.cli.Options;
import org.apache.commons.cli.ParseException;

/** Benchmarking app for reporting performance of various redis-rs Java-clients */
/** Benchmarking app for reporting performance of various Redis Java-clients */
public class BenchmarkingApp {

// main application entrypoint
Expand Down Expand Up @@ -43,12 +43,12 @@ public static void main(String[] args) {
for (ClientName client : runConfiguration.clients) {
switch (client) {
case JEDIS:
// run testClientSetGet on JEDI sync client
System.out.println("Run JEDI sync client");
// run testClientSetGet on JEDIS sync client
System.out.println("Run JEDIS sync client");
break;
case JEDIS_ASYNC:
// run testClientSetGet on JEDI pseudo-async client
System.out.println("Run JEDI pseudo-async client");
// run testClientSetGet on JEDIS pseudo-async client
System.out.println("Run JEDIS pseudo-async client");
break;
case LETTUCE:
// run testClientSetGet on LETTUCE sync client
Expand All @@ -58,8 +58,8 @@ public static void main(String[] args) {
// run testClientSetGet on LETTUCE async client
System.out.println("Run LETTUCE async client");
break;
case BABUSHKA:
System.out.println("Babushka not yet configured");
case BABUSHKA_ASYNC:
System.out.println("Babushka async not yet configured");
break;
}
}
Expand All @@ -68,7 +68,7 @@ public static void main(String[] args) {
try {
runConfiguration.resultsFile.get().close();
} catch (IOException ioException) {
System.out.println("Error closing results file");
System.out.println("Error closing results file: " + ioException.getLocalizedMessage());
}
}
}
Expand All @@ -81,23 +81,29 @@ private static Options getOptions() {
options.addOption(
Option.builder("configuration").hasArg(true).desc("Configuration flag [Release]").build());
options.addOption(
Option.builder("resultsFile").hasArg(true).desc("Result filepath []").build());
options.addOption(Option.builder("dataSize").hasArg(true).desc("Data block size [20]").build());
Option.builder("resultsFile")
.hasArg(true)
.desc("Result filepath (stdout if empty) []")
.build());
options.addOption(
Option.builder("dataSize").hasArg(true).desc("Data block size [100 4000]").build());
options.addOption(
Option.builder("concurrentTasks")
.hasArg(true)
.desc("Number of concurrent tasks [1 10 100]")
.desc("Number of concurrent tasks [100, 1000]")
.build());
options.addOption(
Option.builder("clients")
.hasArg(true)
.desc("one of: all|jedis|jedis_async|lettuce|lettuce_async|babushka [all]")
.desc(
"one of:"
+ " all|jedis|jedis_async|lettuce|lettuce_async|babushka_async|all_async|all_sync"
+ " [all]")
.build());
options.addOption(Option.builder("host").hasArg(true).desc("").build());
options.addOption(Option.builder("host").hasArg(true).desc("Hostname [localhost]").build());
options.addOption(Option.builder("port").hasArg(true).desc("Port number [6379]").build());
options.addOption(
Option.builder("port").hasArg(true).desc("one of: port number [6379]").build());
options.addOption(
Option.builder("clientCount").hasArg(true).desc("Number of cliens to run [1]").build());
Option.builder("clientCount").hasArg(true).desc("Number of clients to run [1]").build());
options.addOption(Option.builder("tls").hasArg(true).desc("TLS [false]").build());

return options;
Expand All @@ -111,16 +117,21 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce
if (configuration.equalsIgnoreCase("Release") || configuration.equalsIgnoreCase("Debug")) {
runConfiguration.configuration = configuration;
} else {
throw new ParseException("Invalid run configuration (Release|Debug)");
throw new ParseException(
"Invalid run configuration (" + configuration + "), must be (Release|Debug)");
}
}

if (line.hasOption("resultsFile")) {
String resultsFileName = line.getOptionValue("resultsFile");
try {
runConfiguration.resultsFile =
Optional.of(new FileWriter(line.getOptionValue("resultsFile")));
} catch (IOException e) {
throw new ParseException("Unable to write to resultsFile.");
runConfiguration.resultsFile = Optional.of(new FileWriter(resultsFileName));
} catch (IOException ioException) {
throw new ParseException(
"Unable to write to resultsFile ("
+ resultsFileName
+ "): "
+ ioException.getMessage());
}
}

Expand All @@ -140,18 +151,18 @@ private static RunConfiguration verifyOptions(CommandLine line) throws ParseExce
return Stream.of(
ClientName.JEDIS,
ClientName.JEDIS_ASYNC,
ClientName.BABUSHKA,
// ClientName.BABUSHKA_ASYNC,
ClientName.LETTUCE,
ClientName.LETTUCE_ASYNC);
case ALL_ASYNC:
return Stream.of(
ClientName.JEDIS_ASYNC,
// ClientName.BABUSHKA,
// ClientName.BABUSHKA_ASYNC,
ClientName.LETTUCE_ASYNC);
case ALL_SYNC:
return Stream.of(
ClientName.JEDIS,
// ClientName.BABUSHKA,
// ClientName.BABUSHKA_ASYNC,
ClientName.LETTUCE);
default:
return Stream.of(e);
Expand Down Expand Up @@ -199,7 +210,7 @@ public enum ClientName {
JEDIS_ASYNC("Jedis async"),
LETTUCE("Lettuce"),
LETTUCE_ASYNC("Lettuce async"),
BABUSHKA("Babushka"),
BABUSHKA_ASYNC("Babushka async"),
ALL("All"),
ALL_SYNC("All sync"),
ALL_ASYNC("All async");
Expand Down Expand Up @@ -235,16 +246,16 @@ public static class RunConfiguration {
public RunConfiguration() {
configuration = "Release";
resultsFile = Optional.empty();
dataSize = new int[] {20};
concurrentTasks = new int[] {10, 100};
dataSize = new int[] {100, 4000};
concurrentTasks = new int[] {100, 1000};
clients =
new ClientName[] {
// ClientName.BABUSHKA,
// ClientName.BABUSHKA_ASYNC,
ClientName.JEDIS, ClientName.JEDIS_ASYNC, ClientName.LETTUCE, ClientName.LETTUCE_ASYNC
};
host = "localhost";
port = 6379;
clientCount = new int[] {1, 2};
clientCount = new int[] {1};
tls = false;
}
}
Expand Down

0 comments on commit 12efc63

Please sign in to comment.