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:12 UTC

[03/24] incubator-tinkerpop git commit: Renamed setting in gremlin-driver.

Renamed setting in gremlin-driver.

"usage" as opposed to "requests" is a more fitting description for that setting.


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

Branch: refs/heads/TINKERPOP3-666
Commit: eff9d9f62e9338142fd2e088548c9824bca05036
Parents: 1ef0cb6
Author: Stephen Mallette <sp...@genoprime.com>
Authored: Thu May 7 12:56:41 2015 -0400
Committer: Stephen Mallette <sp...@genoprime.com>
Committed: Thu May 7 12:56:41 2015 -0400

----------------------------------------------------------------------
 .../tinkerpop/gremlin/driver/Cluster.java       | 12 +++++-----
 .../gremlin/driver/ConnectionPool.java          | 24 ++++++++++----------
 .../tinkerpop/gremlin/driver/Settings.java      |  4 ++--
 .../driver/util/ConfigurationEvaluator.java     |  6 ++---
 .../driver/util/ProfilingApplication.java       |  8 +++----
 5 files changed, 27 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/eff9d9f6/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
index c0a2eaa..b0c78b1 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java
@@ -109,8 +109,8 @@ public class Cluster {
                 .nioPoolSize(settings.nioPoolSize)
                 .workerPoolSize(settings.workerPoolSize)
                 .maxInProcessPerConnection(settings.connectionPool.maxInProcessPerConnection)
-                .maxSimultaneousRequestsPerConnection(settings.connectionPool.maxSimultaneousRequestsPerConnection)
-                .minSimultaneousRequestsPerConnection(settings.connectionPool.minSimultaneousRequestsPerConnection)
+                .maxSimultaneousRequestsPerConnection(settings.connectionPool.maxSimultaneousUsagePerConnection)
+                .minSimultaneousRequestsPerConnection(settings.connectionPool.minSimultaneousUsagePerConnection)
                 .maxConnectionPoolSize(settings.connectionPool.maxSize)
                 .minConnectionPoolSize(settings.connectionPool.minSize);
 
@@ -192,8 +192,8 @@ public class Cluster {
         private int workerPoolSize = Runtime.getRuntime().availableProcessors() * 2;
         private int minConnectionPoolSize = ConnectionPool.MIN_POOL_SIZE;
         private int maxConnectionPoolSize = ConnectionPool.MAX_POOL_SIZE;
-        private int minSimultaneousRequestsPerConnection = ConnectionPool.MIN_SIMULTANEOUS_REQUESTS_PER_CONNECTION;
-        private int maxSimultaneousRequestsPerConnection = ConnectionPool.MAX_SIMULTANEOUS_REQUESTS_PER_CONNECTION;
+        private int minSimultaneousRequestsPerConnection = ConnectionPool.MIN_SIMULTANEOUS_USAGE_PER_CONNECTION;
+        private int maxSimultaneousRequestsPerConnection = ConnectionPool.MAX_SIMULTANEOUS_USAGE_PER_CONNECTION;
         private int maxInProcessPerConnection = Connection.MAX_IN_PROCESS;
         private int minInProcessPerConnection = Connection.MIN_IN_PROCESS;
         private int maxWaitForConnection = Connection.MAX_WAIT_FOR_CONNECTION;
@@ -356,8 +356,8 @@ public class Cluster {
             final Settings.ConnectionPoolSettings connectionPoolSettings = new Settings.ConnectionPoolSettings();
             connectionPoolSettings.maxInProcessPerConnection = this.maxInProcessPerConnection;
             connectionPoolSettings.minInProcessPerConnection = this.minInProcessPerConnection;
-            connectionPoolSettings.maxSimultaneousRequestsPerConnection = this.maxSimultaneousRequestsPerConnection;
-            connectionPoolSettings.minSimultaneousRequestsPerConnection = this.minSimultaneousRequestsPerConnection;
+            connectionPoolSettings.maxSimultaneousUsagePerConnection = this.maxSimultaneousRequestsPerConnection;
+            connectionPoolSettings.minSimultaneousUsagePerConnection = this.minSimultaneousRequestsPerConnection;
             connectionPoolSettings.maxSize = this.maxConnectionPoolSize;
             connectionPoolSettings.minSize = this.minConnectionPoolSize;
             connectionPoolSettings.maxWaitForConnection = this.maxWaitForConnection;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/eff9d9f6/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
index cfbe48e..b2cc050 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java
@@ -45,8 +45,8 @@ class ConnectionPool {
 
     public static final int MIN_POOL_SIZE = 2;
     public static final int MAX_POOL_SIZE = 8;
-    public static final int MIN_SIMULTANEOUS_REQUESTS_PER_CONNECTION = 8;
-    public static final int MAX_SIMULTANEOUS_REQUESTS_PER_CONNECTION = 16;
+    public static final int MIN_SIMULTANEOUS_USAGE_PER_CONNECTION = 8;
+    public static final int MAX_SIMULTANEOUS_USAGE_PER_CONNECTION = 16;
 
     public final Host host;
     private final Cluster cluster;
@@ -55,8 +55,8 @@ class ConnectionPool {
     private final Set<Connection> bin = new CopyOnWriteArraySet<>();
     private final int minPoolSize;
     private final int maxPoolSize;
-    private final int minSimultaneousRequestsPerConnection;
-    private final int maxSimultaneousRequestsPerConnection;
+    private final int minSimultaneousUsagePerConnection;
+    private final int maxSimultaneousUsagePerConnection;
     private final int minInProcess;
     private final String poolLabel;
 
@@ -76,8 +76,8 @@ class ConnectionPool {
         final Settings.ConnectionPoolSettings settings = settings();
         this.minPoolSize = settings.minSize;
         this.maxPoolSize = settings.maxSize;
-        this.minSimultaneousRequestsPerConnection = settings.minSimultaneousRequestsPerConnection;
-        this.maxSimultaneousRequestsPerConnection = settings.maxSimultaneousRequestsPerConnection;
+        this.minSimultaneousUsagePerConnection = settings.minSimultaneousUsagePerConnection;
+        this.maxSimultaneousUsagePerConnection = settings.maxSimultaneousUsagePerConnection;
         this.minInProcess = settings.minInProcessPerConnection;
 
         final List<Connection> l = new ArrayList<>(minPoolSize);
@@ -126,12 +126,12 @@ class ConnectionPool {
             return waitForConnection(timeout, unit);
         }
 
-        // if the number in flight on the least used connection exceeds the max allowed and the pool size is
+        // if the number borrowed on the least used connection exceeds the max allowed and the pool size is
         // not at maximum then consider opening a connection
         final int currentPoolSize = connections.size();
-        if (leastUsedConn.borrowed.get() >= maxSimultaneousRequestsPerConnection && currentPoolSize < maxPoolSize) {
+        if (leastUsedConn.borrowed.get() >= maxSimultaneousUsagePerConnection && currentPoolSize < maxPoolSize) {
             if (logger.isDebugEnabled())
-                logger.debug("Least used {} on {} exceeds maxSimultaneousRequestsPerConnection but pool size {} < maxPoolSize - consider new connection",
+                logger.debug("Least used {} on {} exceeds maxSimultaneousUsagePerConnection but pool size {} < maxPoolSize - consider new connection",
                         leastUsedConn.getConnectionInfo(), host, currentPoolSize);
             considerNewConnection();
         }
@@ -178,10 +178,10 @@ class ConnectionPool {
             // then let the world know the connection is available.
             final int poolSize = connections.size();
             final int availableInProcess = connection.availableInProcess();
-            if (poolSize > minPoolSize && inFlight <= minSimultaneousRequestsPerConnection) {
+            if (poolSize > minPoolSize && inFlight <= minSimultaneousUsagePerConnection) {
                 if (logger.isDebugEnabled())
-                    logger.debug("On {} pool size of {} > minPoolSize {} and borrowed of {} <= minSimultaneousRequestsPerConnection {} so destroy {}",
-                            host, poolSize, minPoolSize, inFlight, minSimultaneousRequestsPerConnection, connection.getConnectionInfo());
+                    logger.debug("On {} pool size of {} > minPoolSize {} and borrowed of {} <= minSimultaneousUsagePerConnection {} so destroy {}",
+                            host, poolSize, minPoolSize, inFlight, minSimultaneousUsagePerConnection, connection.getConnectionInfo());
                 destroyConnection(connection);
             } else if (connection.availableInProcess() < minInProcess) {
                 if (logger.isDebugEnabled())

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/eff9d9f6/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
----------------------------------------------------------------------
diff --git a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
index 2666a21..a8c51cf 100644
--- a/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
+++ b/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Settings.java
@@ -69,8 +69,8 @@ class Settings {
         public boolean enableSsl = false;
         public int minSize = ConnectionPool.MIN_POOL_SIZE;
         public int maxSize = ConnectionPool.MAX_POOL_SIZE;
-        public int minSimultaneousRequestsPerConnection = ConnectionPool.MIN_SIMULTANEOUS_REQUESTS_PER_CONNECTION;
-        public int maxSimultaneousRequestsPerConnection = ConnectionPool.MAX_SIMULTANEOUS_REQUESTS_PER_CONNECTION;
+        public int minSimultaneousUsagePerConnection = ConnectionPool.MIN_SIMULTANEOUS_USAGE_PER_CONNECTION;
+        public int maxSimultaneousUsagePerConnection = ConnectionPool.MAX_SIMULTANEOUS_USAGE_PER_CONNECTION;
         public int maxInProcessPerConnection = Connection.MAX_IN_PROCESS;
         public int minInProcessPerConnection = Connection.MIN_IN_PROCESS;
         public int maxWaitForConnection = Connection.MAX_WAIT_FOR_CONNECTION;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/eff9d9f6/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 e3a8bbe..d445980 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
@@ -31,7 +31,7 @@ public class ConfigurationEvaluator {
 
     private final List<Integer> minConnectionPoolSizeRange = Arrays.asList(1,4,8,12,16,32,64,96,128,160,192,224,256,384,512);
     private final List<Integer> maxConnectionPoolSizeRange = Arrays.asList(4,8,12,16,32,64,96,128,160,192,224,256,384,512);
-    private final List<Integer> maxSimultaneousRequestsPerConnectionRange = Arrays.asList(2,3,4,5,8,16,24,32,64,96,128);
+    private final List<Integer> maxSimultaneousUsagePerConnectionRange = Arrays.asList(2,3,4,5,8,16,24,32,64,96,128);
     private final List<Integer> maxInProcessPerConnectionRange = Arrays.asList(1,2,4,8,12,16,32,64,96,128);
     private final List<Integer> workerPoolSizeRange = Arrays.asList(1,2,3,4,8,16,32);
 
@@ -41,7 +41,7 @@ public class ConfigurationEvaluator {
             for (int iw = 0; iw < maxInProcessPerConnectionRange.size(); iw++) {
                 for (int ix = 0; ix < minConnectionPoolSizeRange.size(); ix++) {
                     for (int iy = 0; iy < maxConnectionPoolSizeRange.size(); iy++) {
-                        for (int iz = 0; iz < maxSimultaneousRequestsPerConnectionRange.size(); iz++) {
+                        for (int iz = 0; iz < maxSimultaneousUsagePerConnectionRange.size(); iz++) {
                             if (minConnectionPoolSizeRange.get(ix) <= maxConnectionPoolSizeRange.get(iy)) {
                                 final Set s = new HashSet(Arrays.asList(iv, iw, ix, iy, iz));
                                 if (!configsTried.contains(s)) {
@@ -50,7 +50,7 @@ public class ConfigurationEvaluator {
                                                       "maxInProcessPerConnection", maxInProcessPerConnectionRange.get(iw).toString(),
                                                       "minConnectionPoolSize", minConnectionPoolSizeRange.get(ix).toString(),
                                                       "maxConnectionPoolSize", maxConnectionPoolSizeRange.get(iy).toString(),
-                                                      "maxSimultaneousRequestsPerConnection", maxSimultaneousRequestsPerConnectionRange.get(iz).toString(),
+                                                      "maxSimultaneousUsagePerConnection", maxSimultaneousUsagePerConnectionRange.get(iz).toString(),
                                                       "noExit", Boolean.TRUE.toString()).toArray();
 
                                     final Object[] withExtraArgs = args.length > 0 ? Stream.concat(Stream.of(args), Stream.of(argsToProfiler)).toArray() : argsToProfiler;

http://git-wip-us.apache.org/repos/asf/incubator-tinkerpop/blob/eff9d9f6/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 52c6125..7a1080d 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
@@ -141,14 +141,14 @@ public class ProfilingApplication {
             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 maxSimultaneousRequestsPerConnection = Integer.parseInt(options.getOrDefault("maxSimultaneousRequestsPerConnection", "32").toString());
+            final int maxSimultaneousUsagePerConnection = Integer.parseInt(options.getOrDefault("maxSimultaneousUsagePerConnection", "32").toString());
             final int maxInProcessPerConnection = Integer.parseInt(options.getOrDefault("maxInProcessPerConnection", "8").toString());
             final int workerPoolSize = Integer.parseInt(options.getOrDefault("workerPoolSize", "4").toString());
 
             final Cluster cluster = Cluster.build(host)
                     .minConnectionPoolSize(minConnectionPoolSize)
                     .maxConnectionPoolSize(maxConnectionPoolSize)
-                    .maxSimultaneousRequestsPerConnection(maxSimultaneousRequestsPerConnection)
+                    .maxSimultaneousRequestsPerConnection(maxSimultaneousUsagePerConnection)
                     .maxInProcessPerConnection(maxInProcessPerConnection)
                     .nioPoolSize(clients)
                     .workerPoolSize(workerPoolSize).create();
@@ -157,7 +157,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("clients\tminConnectionPoolSize\tmaxConnectionPoolSize\tmaxSimultaneousRequestsPerConnection\tmaxInProcessPerConnection\tworkerPoolSize\trequestPerSecond");
+                    writer.println("clients\tminConnectionPoolSize\tmaxConnectionPoolSize\tmaxSimultaneousUsagePerConnection\tmaxInProcessPerConnection\tworkerPoolSize\trequestPerSecond");
                 }
             }
 
@@ -181,7 +181,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(clients), String.valueOf(minConnectionPoolSize), String.valueOf(maxConnectionPoolSize), String.valueOf(maxSimultaneousRequestsPerConnection), String.valueOf(maxInProcessPerConnection), String.valueOf(workerPoolSize), String.valueOf(averageRequestPerSecond)));
+                    writer.println(String.join("\t", String.valueOf(clients), String.valueOf(minConnectionPoolSize), String.valueOf(maxConnectionPoolSize), String.valueOf(maxSimultaneousUsagePerConnection), String.valueOf(maxInProcessPerConnection), String.valueOf(workerPoolSize), String.valueOf(averageRequestPerSecond)));
                 }
             }