public static void main(String[] argv) {
    if (argv.length < 2 || argv.length > 3) {
      System.err.println("Wrong parameters, exit immediately");
      return;
    }

    final String zkQuorum = argv[0];
    final String clusterName = argv[1];
    int clientNumber = 1;
    if (argv.length == 3) {
      clientNumber = Integer.parseInt(argv[2]);
    }

    for (int i = 0; i < clientNumber; ++i) {
      new Thread() {
        @Override
        public void run() {
          try {
            BenchmarkChronosServer benchmark = new BenchmarkChronosServer(zkQuorum, clusterName);
            benchmark.startBenchmark();
          } catch (IOException e) {
            System.err.println("Error to connect with ZooKeeper or ChronosServer to benchmark");
          }
        }
      }.start();
    }

  }
public static void main ( String [ ] argv ) { if ( argv . length < 2 || argv . length > 3 ) { System . err . println ( "Wrong parameters, exit immediately" ) ; return ; } final String zkQuorum = argv [ 0 ] ; final String clusterName = argv [ 1 ] ; int clientNumber = 1 ; if ( argv . length == 3 ) { clientNumber = Integer . parseInt ( argv [ 2 ] ) ; } for ( int i = 0 ; i < clientNumber ; ++ i ) { new Thread ( ) { @ Override public void run ( ) { try { BenchmarkChronosServer benchmark = new BenchmarkChronosServer ( zkQuorum , clusterName ) ; benchmark . startBenchmark ( ) ; } catch ( IOException e ) { System . err . println ( "Error to connect with ZooKeeper or ChronosServer to benchmark" ) ; } } } . start ( ) ; } }
The command-line tool to benchmark ChronosServer and print metrics.
Usage: mvn exec:java -Dexec.mainClass="com.xiaomi.infra.chronos.benchmark.BenchmarkChronosServer" -Dexec.args="$zkQuorum $clientNumber"

@param argv the first one is zkQuorum and the optional second one is clientNumber