You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by sp...@apache.org on 2015/06/29 17:55:17 UTC
[11/13] incubator-tinkerpop git commit: Make the "too slow" threshold
configurable in the profiler.
Make the "too slow" threshold configurable in the profiler.
Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/26ba949f
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/26ba949f
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/26ba949f
Branch: refs/heads/resultset-refactor
Commit: 26ba949f669f9c3849a702198dde2aecc6864ae1
Parents: 87e4e77
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Mon Jun 29 10:30:17 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Mon Jun 29 10:30:17 2015 -0400
----------------------------------------------------------------------
.../gremlin/driver/util/ProfilingApplication.java | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/26ba949f/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/ProfilingApplication.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/ProfilingApplication.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/ProfilingApplication.java
index 20cc3fd..e1db5c2 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/ProfilingApplication.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/ProfilingApplication.java
@@ -49,16 +49,18 @@ public class ProfilingApplication {
private final int requests;
private final String executionName;
private final String script;
+ private final int tooSlowThreshold;
private final ExecutorService executor;
public ProfilingApplication(final String executionName, final Cluster cluster, final int requests, final ExecutorService executor,
- final String script) {
+ final String script, final int tooSlowThreshold) {
this.executionName = executionName;
this.cluster = cluster;
this.requests = requests;
this.executor = executor;
this.script = script;
+ this.tooSlowThreshold = tooSlowThreshold;
}
public long execute() throws Exception {
@@ -74,7 +76,7 @@ public class ProfilingApplication {
IntStream.range(0, requests).forEach(i ->
client.submitAsync(script).thenAcceptAsync(r -> {
try {
- r.all().get(125, TimeUnit.MILLISECONDS);
+ r.all().get(tooSlowThreshold, TimeUnit.MILLISECONDS);
} catch (TimeoutException ex) {
tooSlow.incrementAndGet();
} catch (Exception ex) {
@@ -124,6 +126,7 @@ public class ProfilingApplication {
final int maxInProcessPerConnection = Integer.parseInt(options.getOrDefault("maxInProcessPerConnection", "64").toString());
final int minInProcessPerConnection = Integer.parseInt(options.getOrDefault("minInProcessPerConnection", "16").toString());
final int workerPoolSize = Integer.parseInt(options.getOrDefault("workerPoolSize", "2").toString());
+ final int tooSlowThreshold = Integer.parseInt(options.getOrDefault("tooSlowThreshold", "125").toString());
final String script = options.getOrDefault("script", "1+1").toString();
@@ -150,7 +153,7 @@ public class ProfilingApplication {
final AtomicBoolean meetsRpsExpectation = new AtomicBoolean(true);
System.out.println("---------------------------WARMUP CYCLE---------------------------");
for (int ix = 0; ix < warmups && meetsRpsExpectation.get(); ix++) {
- final long averageRequestsPerSecond = new ProfilingApplication("warmup-" + (ix + 1), cluster, 1000, executor, script).execute();
+ final long averageRequestsPerSecond = new ProfilingApplication("warmup-" + (ix + 1), cluster, 1000, executor, script, tooSlowThreshold).execute();
meetsRpsExpectation.set(averageRequestsPerSecond > minExpectedRps);
TimeUnit.SECONDS.sleep(1); // pause between executions
}
@@ -163,7 +166,7 @@ public class ProfilingApplication {
final long start = System.nanoTime();
System.out.println("----------------------------TEST CYCLE----------------------------");
for (int ix = 0; ix < executions && !exceededTimeout.get(); ix++) {
- totalRequestsPerSecond += new ProfilingApplication("test-" + (ix + 1), cluster, requests, executor, script).execute();
+ totalRequestsPerSecond += new ProfilingApplication("test-" + (ix + 1), cluster, requests, executor, script, tooSlowThreshold).execute();
exceededTimeout.set((System.nanoTime() - start) > TimeUnit.NANOSECONDS.convert(timeout, TimeUnit.MILLISECONDS));
TimeUnit.SECONDS.sleep(1); // pause between executions
}