tinkerpop-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From spmalle...@apache.org
Subject [tinkerpop] branch driver-35 updated: Fixed up driver test utility based on TINKERPOP-2205 which creates one connection per request
Date Wed, 02 Oct 2019 20:11:18 GMT
This is an automated email from the ASF dual-hosted git repository.

spmallette pushed a commit to branch driver-35
in repository https://gitbox.apache.org/repos/asf/tinkerpop.git


The following commit(s) were added to refs/heads/driver-35 by this push:
     new 51cafb6  Fixed up driver test utility based on TINKERPOP-2205 which creates one connection
per request
51cafb6 is described below

commit 51cafb6421103483314837823e89286ff8c783c7
Author: Stephen Mallette <spmva@genoprime.com>
AuthorDate: Wed Oct 2 16:10:02 2019 -0400

    Fixed up driver test utility based on TINKERPOP-2205 which creates one connection per
request
---
 .../driver/util/ConfigurationEvaluator.java        | 58 ++++++----------------
 .../gremlin/driver/util/ProfilingApplication.java  | 30 ++++++-----
 2 files changed, 29 insertions(+), 59 deletions(-)

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 fea23bf..d145592 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
@@ -32,15 +32,9 @@ import java.util.stream.Stream;
  */
 public class ConfigurationEvaluator {
 
-    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(16,32,64,96,128,192,256,384,512);
-    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(16,32,64,96,128);
     private final List<Integer> workerPoolSizeRange = Arrays.asList(1,2,3,4,8,16,32);
     private final List<Integer> nioPoolSizeRange = Arrays.asList(1,2,4);
-    private final List<Integer> parallelismSizeRange = Arrays.asList(1,2,4,8,16);
+    private final List<Integer> parallelismSizeRange = Arrays.asList(1,2,4,8,16,32);
 
     public Stream<String[]> generate(final String [] args) throws Exception {
         final Set<String> configsTried = new HashSet<>();
@@ -49,44 +43,22 @@ public class ConfigurationEvaluator {
         for (int ir = 0; ir < nioPoolSizeRange.size(); ir++) {
             for (int is = 0; is < parallelismSizeRange.size(); is++) {
                 for (int it = 0; it < workerPoolSizeRange.size(); it++) {
-                    for (int iu = 0; iu < minInProcessPerConnectionRange.size(); iu++)
{
-                        for (int iv = 0; iv < maxInProcessPerConnectionRange.size(); iv++)
{
-                            for (int iw = 0; iw < minConnectionPoolSizeRange.size(); iw++)
{
-                                for (int ix = 0; ix < maxConnectionPoolSizeRange.size();
ix++) {
-                                    for (int iy = 0; iy < minSimultaneousUsagePerConnectionRange.size();
iy++) {
-                                        for (int iz = 0; iz < maxSimultaneousUsagePerConnectionRange.size();
iz++) {
-                                            if (minConnectionPoolSizeRange.get(iw) <=
maxConnectionPoolSizeRange.get(ix)
-                                                    && minInProcessPerConnectionRange.get(iu)
<= maxInProcessPerConnectionRange.get(iv)
-                                                    && minSimultaneousUsagePerConnectionRange.get(iy)
<= maxSimultaneousUsagePerConnectionRange.get(iz)
-                                                    && maxSimultaneousUsagePerConnectionRange.get(iz)
<= maxInProcessPerConnectionRange.get(iv)) {
-                                                final String s = String.join(",", String.valueOf(ir),
String.valueOf(is), String.valueOf(it), String.valueOf(iu), String.valueOf(iv), String.valueOf(iw),
String.valueOf(ix), String.valueOf(iy), String.valueOf(iz));
-                                                if (!configsTried.contains(s)) {
-                                                    final Object[] argsToProfiler =
-                                                            Stream.of("nioPoolSize", nioPoolSizeRange.get(ir).toString(),
-                                                                    "parallelism", parallelismSizeRange.get(is).toString(),
-                                                                    "workerPoolSize", workerPoolSizeRange.get(it).toString(),
-                                                                    "minInProcessPerConnection",
minInProcessPerConnectionRange.get(iu).toString(),
-                                                                    "maxInProcessPerConnection",
maxInProcessPerConnectionRange.get(iv).toString(),
-                                                                    "minConnectionPoolSize",
minConnectionPoolSizeRange.get(iw).toString(),
-                                                                    "maxConnectionPoolSize",
maxConnectionPoolSizeRange.get(ix).toString(),
-                                                                    "minSimultaneousUsagePerConnection",
minSimultaneousUsagePerConnectionRange.get(iy).toString(),
-                                                                    "maxSimultaneousUsagePerConnection",
maxSimultaneousUsagePerConnectionRange.get(iz).toString(),
-                                                                    "noExit", Boolean.TRUE.toString()).toArray();
+                    final String s = String.join(",", String.valueOf(ir), String.valueOf(is),
String.valueOf(it));
+                    if (!configsTried.contains(s)) {
+                        final Object[] argsToProfiler =
+                                Stream.of("nioPoolSize", nioPoolSizeRange.get(ir).toString(),
+                                          "parallelism", parallelismSizeRange.get(is).toString(),
+                                          "maxConnectionPoolSize", "15000",
+                                          "workerPoolSize", workerPoolSizeRange.get(it).toString(),
+                                          "noExit", Boolean.TRUE.toString()).toArray();
 
-                                                    final Object[] withExtraArgs = args.length
> 0 ? Stream.concat(Stream.of(args), Stream.of(argsToProfiler)).toArray() : argsToProfiler;
+                        final Object[] withExtraArgs = args.length > 0 ? Stream.concat(Stream.of(args),
Stream.of(argsToProfiler)).toArray() : argsToProfiler;
 
-                                                    final String[] stringProfilerArgs = Arrays.copyOf(withExtraArgs,
withExtraArgs.length, String[].class);
-                                                    System.out.println("Testing with: " +
Arrays.toString(stringProfilerArgs));
-                                                    ProfilingApplication.main(stringProfilerArgs);
-                                                    TimeUnit.SECONDS.sleep(5);
-                                                    configsTried.add(s);
-                                                }
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-                        }
+                        final String[] stringProfilerArgs = Arrays.copyOf(withExtraArgs,
withExtraArgs.length, String[].class);
+                        System.out.println("Testing with: " + Arrays.toString(stringProfilerArgs));
+                        ProfilingApplication.main(stringProfilerArgs);
+                        TimeUnit.SECONDS.sleep(5);
+                        configsTried.add(s);
                     }
                 }
             }
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 b3d20d7..5838ab4 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
@@ -42,7 +42,7 @@ import java.util.concurrent.atomic.AtomicInteger;
 import java.util.stream.IntStream;
 
 /**
- * An internal application used to test out configuration parameters for Gremlin Driver.
+ * An internal application used to test out configuration parameters for Gremlin Driver against
Gremlin Server.
  *
  * @author Stephen Mallette (http://stephen.genoprime.com)
  */
@@ -142,34 +142,24 @@ public class ProfilingApplication {
         final ExecutorService executor = Executors.newFixedThreadPool(parallelism, threadFactory);
 
         final String host = options.getOrDefault("host", "localhost").toString();
-        final int minExpectedRps = Integer.parseInt(options.getOrDefault("minExpectedRps",
"1000").toString());
+        final int minExpectedRps = Integer.parseInt(options.getOrDefault("minExpectedRps",
"200").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());
         final int nioPoolSize = Integer.parseInt(options.getOrDefault("nioPoolSize", "1").toString());
         final int requests = Integer.parseInt(options.getOrDefault("requests", "10000").toString());
-        final int minConnectionPoolSize = Integer.parseInt(options.getOrDefault("minConnectionPoolSize",
"256").toString());
         final int maxConnectionPoolSize = Integer.parseInt(options.getOrDefault("maxConnectionPoolSize",
"256").toString());
-        final int minSimultaneousUsagePerConnection = Integer.parseInt(options.getOrDefault("minSimultaneousUsagePerConnection",
"8").toString());
-        final int maxSimultaneousUsagePerConnection = Integer.parseInt(options.getOrDefault("maxSimultaneousUsagePerConnection",
"32").toString());
-        final int maxInProcessPerConnection = Integer.parseInt(options.getOrDefault("maxInProcessPerConnection",
"64").toString());
-        final int minInProcessPerConnection = Integer.parseInt(options.getOrDefault("minInProcessPerConnection",
"16").toString());
         final int maxWaitForConnection = Integer.parseInt(options.getOrDefault("maxWaitForConnection",
"3000").toString());
         final int workerPoolSize = Integer.parseInt(options.getOrDefault("workerPoolSize",
"2").toString());
         final int tooSlowThreshold = Integer.parseInt(options.getOrDefault("tooSlowThreshold",
"125").toString());
         final String channelizer = options.getOrDefault("channelizer", Channelizer.WebSocketChannelizer.class.getName()).toString();
-        final String serializer = options.getOrDefault("serializer", Serializers.GRYO_V1D0.name()).toString();
+        final String serializer = options.getOrDefault("serializer", Serializers.GRAPHBINARY_V1D0.name()).toString();
 
         final boolean exercise = Boolean.parseBoolean(options.getOrDefault("exercise", "false").toString());
         final String script = options.getOrDefault("script", "1+1").toString();
 
         final Cluster cluster = Cluster.build(host)
-                .minConnectionPoolSize(minConnectionPoolSize)
                 .maxConnectionPoolSize(maxConnectionPoolSize)
-                .minSimultaneousUsagePerConnection(minSimultaneousUsagePerConnection)
-                .maxSimultaneousUsagePerConnection(maxSimultaneousUsagePerConnection)
-                .minInProcessPerConnection(minInProcessPerConnection)
-                .maxInProcessPerConnection(maxInProcessPerConnection)
                 .nioPoolSize(nioPoolSize)
                 .channelizer(channelizer)
                 .maxWaitForConnection(maxWaitForConnection)
@@ -193,7 +183,7 @@ public class ProfilingApplication {
             final File f = null == fileName ? null : new File(fileName.toString());
             if (f != null && f.length() == 0) {
                 try (final PrintWriter writer = new PrintWriter(new BufferedWriter(new FileWriter(f,
true)))) {
-                    writer.println("parallelism\tnioPoolSize\tminConnectionPoolSize\tmaxConnectionPoolSize\tminSimultaneousUsagePerConnection\tmaxSimultaneousUsagePerConnection\tminInProcessPerConnection\tmaxInProcessPerConnection\tworkerPoolSize\trequestPerSecond");
+                    writer.println("parallelism\tnioPoolSize\tmaxConnectionPoolSize\tworkerPoolSize\trequestPerSecond");
                 }
             }
 
@@ -202,7 +192,15 @@ public class ProfilingApplication {
             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, tooSlowThreshold, exercise).execute();
-                meetsRpsExpectation.set(averageRequestsPerSecond > minExpectedRps);
+
+                // check rps on last warmup round. by then pools should be initialized fully
+                if (ix + 1 == warmups)
+                    meetsRpsExpectation.set(averageRequestsPerSecond > minExpectedRps);
+
+                if (!meetsRpsExpectation.get()) {
+                    System.out.println("Failed to meet minimum RPS at " + averageRequestsPerSecond);
+                }
+
                 TimeUnit.SECONDS.sleep(1); // pause between executions
             }
 
@@ -224,7 +222,7 @@ public class ProfilingApplication {
             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)))) {
-                    writer.println(String.join("\t", String.valueOf(parallelism), String.valueOf(nioPoolSize),
String.valueOf(minConnectionPoolSize), String.valueOf(maxConnectionPoolSize), String.valueOf(minSimultaneousUsagePerConnection),
String.valueOf(maxSimultaneousUsagePerConnection), String.valueOf(minInProcessPerConnection),
String.valueOf(maxInProcessPerConnection), String.valueOf(workerPoolSize), String.valueOf(averageRequestPerSecond)));
+                    writer.println(String.join("\t", String.valueOf(parallelism), String.valueOf(nioPoolSize),
String.valueOf(maxConnectionPoolSize), String.valueOf(workerPoolSize), String.valueOf(averageRequestPerSecond)));
                 }
             }
 


Mime
View raw message