{
try
{
// Use the AppHelper utility class to retrieve command line application parameters
// Define parameters and pull from command line
AppHelper apph = new AppHelper(AsyncBenchmark.class.getCanonicalName())
.add("displayinterval", "display_interval_in_seconds", "Interval for performance feedback, in seconds.", 10)
.add("duration", "run_duration_in_seconds", "Benchmark duration, in seconds.", 120)
.add("servers", "comma_separated_server_list", "List of VoltDB servers to connect to.", "localhost")
.add("port", "port_number", "Client port to connect to on cluster nodes.", 21212)
.add("pool-size", "pool_size", "Size of the record pool to operate on - larger sizes will cause a higher insert/update-delete rate.", 100000)
.add("procedure", "procedure_name", "Procedure to call.", "UpdateKey")
.add("wait", "wait_duration", "Wait duration (only when calling one of the Wait procedures), in milliseconds.", 0)
.add("ratelimit", "rate_limit", "Rate limit to start from (number of transactions per second).", 100000)
.add("autotune", "auto_tune", "Flag indicating whether the benchmark should self-tune the transaction rate for a target execution latency (true|false).", "true")
.add("latency-target", "latency_target", "Execution latency to target to tune transaction rate (in milliseconds).", 10.0d)
.add("run-loader", "Run the leveldb loader", "true")
.setArguments(args)
;
// Retrieve parameters
final long displayInterval = apph.longValue("displayinterval");
final long duration = apph.longValue("duration");
final String servers = apph.stringValue("servers");
final int port = apph.intValue("port");
final int poolSize = apph.intValue("pool-size");
final String procedure = apph.stringValue("procedure");
final long wait = apph.intValue("wait");
final long rateLimit = apph.longValue("ratelimit");
final boolean autoTune = apph.booleanValue("autotune");
final double latencyTarget = apph.doubleValue("latency-target");
final String csv = apph.stringValue("stats");
final boolean runLoader = apph.booleanValue("run-loader");
// Validate parameters
apph.validate("duration", (duration > 0))
.validate("pool-size", (duration > 0))
.validate("wait", (wait >= 0))
.validate("ratelimit", (rateLimit > 0))
.validate("latency-target", (latencyTarget > 0))
;
// Display actual parameters, for reference
apph.printActualUsage();
// Get a client connection - we retry for a while in case the server hasn't started yet
Con = ClientConnectionPool.getWithRetry(servers, port);
// Create a Timer task to display performance data on the procedure