public long executeThroughput() throws Exception {
        final AtomicInteger tooSlow = new AtomicInteger(0);
        final AtomicInteger errors = new AtomicInteger(0);

        final Client client = cluster.connect();
        final String executionId = "[" + executionName + "]";
        try {
            final CountDownLatch latch = new CountDownLatch(requests);
            client.init();

            final long start = System.nanoTime();
            IntStream.range(0, requests).forEach(i -> {
                final String s = exercise ? chooseScript() : script;
                client.submitAsync(s).thenAcceptAsync(r -> {
                    try {
                        r.all().get(tooSlowThreshold, TimeUnit.MILLISECONDS);
                    } catch (TimeoutException ex) {
                        tooSlow.incrementAndGet();
                    } catch (Exception ex) {
                        errors.incrementAndGet();
                        if (!suppressStackTraces) ex.printStackTrace();
                    } finally {
                        latch.countDown();
                    }
                }, executor);
            });

            // finish once all requests are accounted for
            latch.await();

            final long end = System.nanoTime();
            final long total = end - start;
            final double totalSeconds = total / 1000000000d;
            final long requestCount = requests;
            final long reqSec = Math.round(requestCount / totalSeconds);
            System.out.println(String.format(StringUtils.rightPad(executionId, 10) + " requests: %s | time(s): %s | req/sec: %s | too slow: %s | errors: %s",
                    requestCount,
                    StringUtils.rightPad(String.valueOf(totalSeconds), 14),
                    StringUtils.rightPad(String.valueOf(reqSec), 7), exercise ? "N/A" : tooSlow.get(),
                    errors.get()));
            return reqSec;
        } catch (Exception ex) {
            // catch all so that it doesn't tank the whole execution. returning 0 will hose up calculations on
            // averages, but presumably you'd see the failed executions and be suspicious.
            System.out.println("Failed Execution: " + executionName + " - " + ex.getMessage());
            return 0;
        } finally {
            client.close();
        }
    }
An internal application used to test out configuration parameters for Gremlin Driver.

@author Stephen Mallette (http://stephen.genoprime.com)
gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/ProfilingApplication.java