Пример #1
0
  /**
   * Runs the stress test.
   *
   * @param clients number of clients
   * @param runs number of runs per client
   * @throws Exception exception
   */
  private static void run(final int clients, final int runs) throws Exception {
    // Create test database
    Command cmd = new CreateDB(NAME, INPUT);
    cmd.execute(context);

    // Start clients
    final Client[] cl = new Client[clients];
    for (int i = 0; i < clients; ++i) cl[i] = new Client(runs);
    for (final Client c : cl) c.start();
    for (final Client c : cl) c.join();
    // Drop database
    cmd = new DropDB(NAME);
    cmd.execute(context);
  }
Пример #2
0
 /**
  * Runs the stress test.
  *
  * @param clients number of clients
  * @param runs number of runs per client
  * @throws Exception exception
  */
 private void run(final int clients, final int runs) throws Exception {
   // run server instance
   server = createServer();
   // create test database
   try (final ClientSession cs = createClient()) {
     cs.execute("create db test " + INPUT);
     // run clients
     final Client[] cl = new Client[clients];
     for (int i = 0; i < clients; ++i) cl[i] = new Client(runs);
     for (final Client c : cl) c.start();
     for (final Client c : cl) c.join();
     // drop database and stop server
     cs.execute("drop db test");
   }
   stopServer(server);
 }