Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/main/java/com/rabbitmq/stream/perf/Converters.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ final class Converters {
private static final CommandLine.ITypeConverter<Duration> DURATION_TYPE_CONVERTER =
new DurationTypeConverter();

static final CommandLine.ITypeConverter<Boolean> BOOLEAN_TYPE_CONVERTER = new BooleanConverter();

private Converters() {}

static void typeConversionException(String message) {
Expand Down Expand Up @@ -434,6 +436,18 @@ public Integer convert(String input) {
}
}

static class BooleanConverter implements CommandLine.ITypeConverter<Boolean> {

@Override
public Boolean convert(String value) {
if ("true".equalsIgnoreCase(value) || "false".equalsIgnoreCase(value)) {
return Boolean.parseBoolean(value);
} else {
throw new CommandLine.TypeConversionException("'" + value + "' is not a boolean");
}
}
}

private static void throwConversionException(String format, String... arguments) {
throw new CommandLine.TypeConversionException(String.format(format, (Object[]) arguments));
}
Expand Down
138 changes: 120 additions & 18 deletions src/main/java/com/rabbitmq/stream/perf/StreamPerfTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
name = "stream-perf-test",
mixinStandardHelpOptions = false,
showDefaultValues = true,
separator = " ",
description = "Tests the performance of stream queues in RabbitMQ.")
public class StreamPerfTest implements Callable<Integer> {

Expand Down Expand Up @@ -169,8 +170,14 @@ public class StreamPerfTest implements Callable<Integer> {
@CommandLine.Option(
names = {"--delete-streams", "-ds"},
description = "whether to delete stream(s) after the run or not",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean deleteStreams;
void setDeleteStreams(String input) throws Exception {
this.deleteStreams = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean deleteStreams;

@CommandLine.Option(
names = {"--offset", "-o"},
Expand Down Expand Up @@ -265,14 +272,26 @@ public class StreamPerfTest implements Callable<Integer> {
@CommandLine.Option(
names = {"--version", "-v"},
description = "show version information",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean version;
void setVersion(String input) throws Exception {
this.version = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean version;

@CommandLine.Option(
names = {"--summary-file", "-sf"},
description = "generate a summary file with metrics",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean summaryFile;
void setSummaryFile(String input) throws Exception {
this.summaryFile = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean summaryFile;

@CommandLine.Option(
names = {"--producers-by-connection", "-pbc"},
Expand Down Expand Up @@ -309,8 +328,14 @@ public class StreamPerfTest implements Callable<Integer> {
@CommandLine.Option(
names = {"--load-balancer", "-lb"},
description = "assume URIs point to a load balancer",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean loadBalancer;
void setLoadBalancer(String input) throws Exception {
this.loadBalancer = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean loadBalancer;

@CommandLine.Option(
names = {"--consumer-names", "-cn"},
Expand All @@ -324,14 +349,26 @@ public class StreamPerfTest implements Callable<Integer> {
@CommandLine.Option(
names = {"--metrics-byte-rates", "-mbr"},
description = "include written and read byte rates in metrics",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean includeByteRates;
void setIncludeByteRates(String input) throws Exception {
this.includeByteRates = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean includeByteRates;

@CommandLine.Option(
names = {"--memory-report", "-mr"},
description = "report information on memory settings and usage",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean memoryReport;
void setMemoryReport(String input) throws Exception {
this.memoryReport = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean memoryReport;

@CommandLine.Option(
names = {"--server-name-indication", "-sni"},
Expand All @@ -349,8 +386,14 @@ public class StreamPerfTest implements Callable<Integer> {
@CommandLine.Option(
names = {"--environment-variables", "-env"},
description = "show usage with environment variables",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean environmentVariables;
void setEnvironmentVariables(String input) throws Exception {
this.environmentVariables = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean environmentVariables;

@CommandLine.Option(
names = {"--rpc-timeout", "-rt"},
Expand All @@ -362,14 +405,26 @@ public class StreamPerfTest implements Callable<Integer> {
@CommandLine.Option(
names = {"--confirm-latency", "-cl"},
description = "evaluate confirm latency",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean confirmLatency;
void setConfirmLatency(String input) throws Exception {
this.confirmLatency = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean confirmLatency;

@CommandLine.Option(
names = {"--super-streams", "-sst"},
description = "use super streams (RabbitMQ 3.13+)",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean superStreams;
void setSuperStreams(String input) throws Exception {
this.superStreams = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean superStreams;

@CommandLine.Option(
names = {"--super-stream-partitions", "-ssp"},
Expand All @@ -381,8 +436,14 @@ public class StreamPerfTest implements Callable<Integer> {
@CommandLine.Option(
names = {"--single-active-consumer", "-sac"},
description = "use single active consumer",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean singleActiveConsumer;
void setSingleActiveConsumer(String input) throws Exception {
this.singleActiveConsumer = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean singleActiveConsumer;

@CommandLine.Option(
names = {"--amqp-uri", "-au"},
Expand All @@ -406,8 +467,14 @@ public class StreamPerfTest implements Callable<Integer> {
@CommandLine.Option(
names = {"--metrics-command-line-arguments", "-mcla"},
description = "add fixed metrics with command line arguments label",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean metricsCommandLineArguments;
void setMetricsCommandLineArguments(String input) throws Exception {
this.metricsCommandLineArguments = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean metricsCommandLineArguments;

@CommandLine.Option(
names = {"--requested-max-frame-size", "-rmfs"},
Expand All @@ -419,8 +486,14 @@ public class StreamPerfTest implements Callable<Integer> {
@CommandLine.Option(
names = {"--native-epoll", "-ne"},
description = "use Netty's native epoll transport (Linux x86-64 only)",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean nativeEpoll;
void setNativeEpoll(String input) throws Exception {
this.nativeEpoll = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean nativeEpoll;

@ArgGroup(exclusive = false, multiplicity = "0..1")
InstanceSyncOptions instanceSyncOptions;
Expand All @@ -447,26 +520,50 @@ public class StreamPerfTest implements Callable<Integer> {
@CommandLine.Option(
names = {"--force-replica-for-consumers", "-frfc"},
description = "force the connection to a replica for consumers",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean forceReplicaForConsumers;
void setForceReplicaForConsumers(String input) throws Exception {
this.forceReplicaForConsumers = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean forceReplicaForConsumers;

@CommandLine.Option(
names = {"--no-dev-mode", "-ndm"},
description = "do not use development mode (useful for local cluster)",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean noDevMode;
void setNoDevMode(String input) throws Exception {
this.noDevMode = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean noDevMode;

@CommandLine.Option(
names = {"--dynamic-batch-size", "-dbs"},
description = "use dynamic batch size for publishing",
arity = "0..1",
fallbackValue = "true",
defaultValue = "true")
private boolean dynamicBatch;
void setDynamicBatch(String input) throws Exception {
this.dynamicBatch = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean dynamicBatch;

@CommandLine.Option(
names = {"--batch-size-metric", "-bsm"},
description = "display batch size",
arity = "0..1",
fallbackValue = "true",
defaultValue = "false")
private boolean includeBatchSizeMetric;
void setIncludeByteSizeMetric(String input) throws Exception {
this.includeBatchSizeMetric = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean includeBatchSizeMetric;

static class InstanceSyncOptions {

Expand Down Expand Up @@ -553,9 +650,14 @@ static class InstanceSyncOptions {
@CommandLine.Option(
names = {"--tcp-no-delay", "-tnd"},
description = "TCP NODELAY",
arity = "1",
arity = "0..1",
fallbackValue = "true",
defaultValue = "true")
private boolean tcpNoDelay;
void setTcpNoDelay(String input) throws Exception {
this.tcpNoDelay = Converters.BOOLEAN_TYPE_CONVERTER.convert(input);
}

boolean tcpNoDelay;

@CommandLine.Option(
names = {"--consumer-latency", "-L"},
Expand Down
Loading