You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tinkerpop.apache.org by dk...@apache.org on 2015/05/07 23:30:22 UTC

[13/24] incubator-tinkerpop git commit: Improve killing the profiling app if the works is just too slow.

Improve killing the profiling app if the works is just too slow.


Project: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/commit/dd052ce1
Tree: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/tree/dd052ce1
Diff: http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/diff/dd052ce1

Branch: refs/heads/TINKERPOP3-666
Commit: dd052ce1d603d9ab96e91d1ac15b693eaa3dc4dc
Parents: 359bfaf
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 7 14:21:15 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu May 7 14:21:15 2015 -0400

----------------------------------------------------------------------
 .../driver/util/ConfigurationEvaluator.java     |  6 ++---
 .../driver/util/ProfilingApplication.java       | 26 +++++++++++++-------
 2 files changed, 20 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/dd052ce1/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/ConfigurationEvaluator.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/ConfigurationEvaluator.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/ConfigurationEvaluator.java
index fbfd3dd..a00d7d1 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/ConfigurationEvaluator.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/util/ConfigurationEvaluator.java
@@ -29,13 +29,13 @@ import java.util.stream.Stream;
  */
 public class ConfigurationEvaluator {
 
-    private final List<Integer> minConnectionPoolSizeRange = Arrays.asList(1,4,8,12,16,32,64,96,128,192,256,384,512);
+    private final List<Integer> minConnectionPoolSizeRange = Arrays.asList(4,8,12,16,32,64,96,128,192,256,384,512);
     private final List<Integer> maxConnectionPoolSizeRange = Arrays.asList(4,8,12,16,32,64,96,128,192,256,384,512);
-    private final List<Integer> minSimultaneousUsagePerConnectionRange = Arrays.asList(2,4,8,16,24,32,64,96,128);
+    private final List<Integer> minSimultaneousUsagePerConnectionRange = Arrays.asList(4,8,16,24,32,64,96,128);
     private final List<Integer> maxSimultaneousUsagePerConnectionRange = Arrays.asList(4,8,16,24,32,64,96,128);
     private final List<Integer> minInProcessPerConnectionRange = Arrays.asList(2,4,8,16,32,64,96,128);
     private final List<Integer> maxInProcessPerConnectionRange = Arrays.asList(4,8,16,32,64,96,128);
-    private final List<Integer> workerPoolSizeRange = Arrays.asList(1,2,3,4,8,16,32);
+    private final List<Integer> workerPoolSizeRange = Arrays.asList(2,3,4,8,16,32);
 
     public Stream<String[]> generate(final String [] args) {
         final Set<Set<Integer>> configsTried = new HashSet<>();

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/dd052ce1/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 5001aff..1066cb7 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
@@ -132,6 +132,7 @@ public class ProfilingApplication {
 
         try {
             final String host = options.getOrDefault("host", "localhost").toString();
+            final int minExpectedRps = Integer.parseInt(options.getOrDefault("minExpectedRps", "1000").toString());
             final int timeout = Integer.parseInt(options.getOrDefault("timeout", "1200000").toString());
             final int warmups = Integer.parseInt(options.getOrDefault("warmups", "5").toString());
             final int executions = Integer.parseInt(options.getOrDefault("executions", "10").toString());
@@ -163,23 +164,30 @@ public class ProfilingApplication {
                 }
             }
 
+            // not much point to continuing with a line of tests if we can't get at least minExpectedRps.
+            final AtomicBoolean meetsRpsExpectation = new AtomicBoolean(true);
             System.out.println("---------------------------WARMUP CYCLE---------------------------");
-            for (int ix = 0; ix < warmups; ix++) {
-                new ProfilingApplication("warmup-" + (ix + 1), cluster, clients, requests).execute();
+            for (int ix = 0; ix < warmups && meetsRpsExpectation.get(); ix++) {
+                final long averageRequestsPerSecond = new ProfilingApplication("warmup-" + (ix + 1), cluster, clients, 1000).execute();
+                meetsRpsExpectation.set(averageRequestsPerSecond > minExpectedRps);
                 TimeUnit.SECONDS.sleep(1); // pause between executions
             }
 
             final AtomicBoolean exceededTimeout = new AtomicBoolean(false);
-            final long start = System.nanoTime();
-            System.out.println("----------------------------TEST CYCLE----------------------------");
             long totalRequestsPerSecond = 0;
-            for (int ix = 0; ix < executions && !exceededTimeout.get(); ix++) {
-                totalRequestsPerSecond += new ProfilingApplication("test-" + (ix + 1), cluster, clients, requests).execute();
-                exceededTimeout.set((System.nanoTime() - start) > TimeUnit.NANOSECONDS.convert(timeout, TimeUnit.MILLISECONDS));
-                TimeUnit.SECONDS.sleep(1); // pause between executions
+
+            // no need to execute this if we didn't pass the basic expectation in the warmups
+            if (meetsRpsExpectation.get()) {
+                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, clients, requests).execute();
+                    exceededTimeout.set((System.nanoTime() - start) > TimeUnit.NANOSECONDS.convert(timeout, TimeUnit.MILLISECONDS));
+                    TimeUnit.SECONDS.sleep(1); // pause between executions
+                }
             }
 
-            final int averageRequestPerSecond = exceededTimeout.get() ? 0 : Math.round(totalRequestsPerSecond / executions);
+            final int averageRequestPerSecond = !meetsRpsExpectation.get() || exceededTimeout.get() ? 0 : Math.round(totalRequestsPerSecond / executions);
             System.out.println(String.format("avg req/sec: %s", averageRequestPerSecond));
             if (f != null) {
                 try (final PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(f, true)))) {