[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17240445#comment-17240445 ] Divij Vaidya commented on TINKERPOP-2445: - *Benchmark results* || ||3.4.8||3.4.9|| |setup and close 100 connections|2116 ms|35 ms| |setup and close 32 connections|2081 ms|13 ms| |setup and close 1 connection|2046 ms|2 ms| *Benchmark setup (uses JMH for micro benchmarking)* Machine: MacBook Pro (16-inch, 2019) Memory: 16 GB 2667 MHz DDR4 Processor: 2.6 GHz 6-Core Intel Core i7 Benchmark uses standard gremlin-server with default configuration for testing. Benchmark code: {code:java} {code} *package com.diviv.test; import groovy.util.logging.Slf4j; import org.apache.tinkerpop.gremlin.driver.Client; import org.apache.tinkerpop.gremlin.driver.Cluster; import org.openjdk.jmh.annotations.Benchmark; import org.openjdk.jmh.annotations.BenchmarkMode; import org.openjdk.jmh.annotations.Mode; import org.openjdk.jmh.annotations.OutputTimeUnit; import org.openjdk.jmh.runner.Runner; import org.openjdk.jmh.runner.RunnerException; import org.openjdk.jmh.runner.options.Options; import org.openjdk.jmh.runner.options.OptionsBuilder; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.concurrent.TimeUnit; @Slf4j public class TestAppUsingClient \{ private static Logger log = LoggerFactory.getLogger(TestAppUsingClient.class); @Benchmark @BenchmarkMode(Mode.AverageTime) @OutputTimeUnit(TimeUnit.MILLISECONDS) public void initClient() { Cluster cluster = null; try { log.info("Setup:Start Init the cluster."); Cluster.Builder builder = Cluster.build(); builder.addContactPoint("localhost"); builder.port(8182); builder.maxConnectionPoolSize(1); builder.minConnectionPoolSize(1); cluster = builder.create(); Client client = cluster.connect(); client.init(); } finally \{ cluster.close(); } } public static void main(String[] args) throws RunnerException \{ Options opt = new OptionsBuilder() .include(TestAppUsingClient.class.getSimpleName()) .forks(1) .build(); new Runner(opt).run(); } }* > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17240427#comment-17240427 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya merged pull request #1363: URL: https://github.com/apache/tinkerpop/pull/1363 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17239816#comment-17239816 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya commented on a change in pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#discussion_r531741315 ## File path: pom.xml ## @@ -721,6 +722,18 @@ limitations under the License. + Review comment: Thank you for helping fix this Stephen. Appreciate it 磊 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17239696#comment-17239696 ] ASF GitHub Bot commented on TINKERPOP-2445: --- spmallette commented on a change in pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#discussion_r531623301 ## File path: pom.xml ## @@ -721,6 +722,18 @@ limitations under the License. + Review comment: Figured out the fix i think: 8ea559e13e8e877a85c02d73178a675f31ac42b0 - builds for me locally now with `mvn clean install`. will keep an eye on travis for the full build though. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17239275#comment-17239275 ] ASF GitHub Bot commented on TINKERPOP-2445: --- spmallette commented on a change in pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#discussion_r531031219 ## File path: pom.xml ## @@ -721,6 +722,18 @@ limitations under the License. + Review comment: build failures on `master` are due to powermock incompatibility with java 11 and our upgrade on the mockito version. not sure how you want to best resolve those - i tried a couple quick things but couldn't get it working immediately: https://stackoverflow.com/questions/52966897/powermock-java-11 https://stackoverflow.com/questions/62305373/how-to-use-powermock-with-mockito3-x I sense it is something that can be resolved though, but i'll leave it to you at this point. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17238910#comment-17238910 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya merged pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17237802#comment-17237802 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya merged pull request #1355: URL: https://github.com/apache/tinkerpop/pull/1355 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17236155#comment-17236155 ] ASF GitHub Bot commented on TINKERPOP-2445: --- spmallette commented on pull request #1363: URL: https://github.com/apache/tinkerpop/pull/1363#issuecomment-731175556 i think we generally take it as implied that you are in favor of your own work by just submitting the PR but don't forget to include your own "VOTE +1" on your own PRs - just a bit of extra formality that we gathered from Apache at some point. VOTE +1 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17236149#comment-17236149 ] ASF GitHub Bot commented on TINKERPOP-2445: --- spmallette commented on pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#issuecomment-731171722 VOTE +1 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17235829#comment-17235829 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya opened a new pull request #1363: URL: https://github.com/apache/tinkerpop/pull/1363 https://issues.apache.org/jira/browse/TINKERPOP-2445 **Problem**: Client init and shutdown takes ~2s with 100 connections even if we aren't sending any queries at all (against a locally running server w/o ssl). **Reason**: 95% of the time is taken by shutdown. More specifically, [this line](https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java) where we close Netty's event loop group. The default setting for closing the event loop group contains a "quiet time" of 2s, during which it will allow more requests to be handled by the executor. Thus, it will always wait at least 2s before shutting down. This 2s is configurable and we could change it instead of using the default. **Change**: We are changing the quiet time to 0 because the event loop group is shutdown after executor (worker threads) are shutdown in a similar manner where we don't allow any more requests. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17235805#comment-17235805 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya commented on pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#issuecomment-730724811 > I like the new behavior you have here - do you have any sense of how much initialization speed you gained in making these changes? Once we have merge this, the removal of serializer one and another PR about shutdown I am filing soon, I will perform a benchmark and add results to upgrade documentation. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17235800#comment-17235800 ] Divij Vaidya commented on TINKERPOP-2445: - The problem is not with client initialization. The problem is with `shutdownGracefully()` method used here [https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Cluster.java] This method by default waits for a "quiet period" of 2s before proceeding with the shutdown. Thus, a client initialization and shutdown will always take at least 2s. > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17234980#comment-17234980 ] ASF GitHub Bot commented on TINKERPOP-2445: --- spmallette commented on a change in pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#discussion_r526386649 ## File path: pom.xml ## @@ -721,6 +722,18 @@ limitations under the License. + Review comment: ok - thanks for the explanation. let's go with what you've done then. thanks This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17234966#comment-17234966 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya commented on a change in pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#discussion_r526370414 ## File path: gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java ## @@ -861,12 +864,28 @@ public void shouldMarkHostDeadSinceServerIsDown() throws Exception { final Cluster cluster = TestClientFactory.open(); try { assertEquals(0, cluster.availableHosts().size()); -cluster.connect().init(); +final Client client1 = cluster.connect().init(); assertEquals(1, cluster.availableHosts().size()); stopServer(); +// We create a new client here which will fail to initialize but the original client still has +// host marked as connected. Since the second client failed during initialization, it has no way to +// test if a host is indeed unreachable because it doesn't have any established connections. It will not add +// the host to load balancer but it will also not remove it if it already exists there. Leave that +// responsibility to a client that added it. In this case, let the second client perform it's own mechanism +// to mark host as unavailable. The first client will discover that the host has failed either with next +// keepAlive message or the next request, whichever is earlier. In this case, we will simulate the second +// scenario by sending a new request on first client. The request would fail (since server is down) and +// client should mark the host unavailable. cluster.connect().init(); + +try { +client1.submit("1+1").all().join(); Review comment: Good point. Added. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17234963#comment-17234963 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya commented on a change in pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#discussion_r526368398 ## File path: gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializerTest.java ## @@ -93,7 +93,7 @@ public void readValueAndWriteValueShouldBeSymmetric() throws IOException { writer.writeValue(person, buffer, nullable); final SamplePerson actual = reader.readValue(buffer, SamplePerson.class, nullable); -assertThat(actual, new ReflectionEquals(person)); +Assert.assertTrue(new ReflectionEquals(person).matches(actual)); Review comment: Oh yes. This is a side effect of the change when I upgraded mockito to 2.x so that we could use it to mock final classes. It's not required in current review since we are using powermock. I will revert it back. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17234956#comment-17234956 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya commented on a change in pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#discussion_r526365003 ## File path: pom.xml ## @@ -721,6 +722,18 @@ limitations under the License. + Review comment: We have two requirements here. Ability to mock a final class and use spy to mock a new initialization inside method which is being tested. Using mockito to mock final classes require using an [incubating](https://github.com/mockito/mockito/wiki/What%27s-new-in-Mockito-2#unmockable) feature in mockito. I tried using that feature but it doesn't work very nicely with spy right now. Hence, powermock is the next best option. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17234604#comment-17234604 ] ASF GitHub Bot commented on TINKERPOP-2445: --- spmallette commented on pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#issuecomment-729668582 I like the new behavior you have here - do you have any sense of how much initialization speed you gained in making these changes? Also, i think this is a nice improvement to write a few words about in the Upgrade Documentation - always good to call attention to performance enhancements. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17234600#comment-17234600 ] ASF GitHub Bot commented on TINKERPOP-2445: --- spmallette commented on a change in pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#discussion_r526072615 ## File path: gremlin-driver/src/test/java/org/apache/tinkerpop/gremlin/driver/ser/binary/types/sample/SamplePersonSerializerTest.java ## @@ -93,7 +93,7 @@ public void readValueAndWriteValueShouldBeSymmetric() throws IOException { writer.writeValue(person, buffer, nullable); final SamplePerson actual = reader.readValue(buffer, SamplePerson.class, nullable); -assertThat(actual, new ReflectionEquals(person)); +Assert.assertTrue(new ReflectionEquals(person).matches(actual)); Review comment: nit: we tend to prefer to statically import the assertion method and to avoid `assertTrue()` which provides a terrible failure message, thus we would typically prefer: `assertThat(new ReflectionEquals(person).matches(actual), is(true))` This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17234597#comment-17234597 ] ASF GitHub Bot commented on TINKERPOP-2445: --- spmallette commented on a change in pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#discussion_r526070384 ## File path: gremlin-server/src/test/java/org/apache/tinkerpop/gremlin/server/GremlinDriverIntegrateTest.java ## @@ -861,12 +864,28 @@ public void shouldMarkHostDeadSinceServerIsDown() throws Exception { final Cluster cluster = TestClientFactory.open(); try { assertEquals(0, cluster.availableHosts().size()); -cluster.connect().init(); +final Client client1 = cluster.connect().init(); assertEquals(1, cluster.availableHosts().size()); stopServer(); +// We create a new client here which will fail to initialize but the original client still has +// host marked as connected. Since the second client failed during initialization, it has no way to +// test if a host is indeed unreachable because it doesn't have any established connections. It will not add +// the host to load balancer but it will also not remove it if it already exists there. Leave that +// responsibility to a client that added it. In this case, let the second client perform it's own mechanism +// to mark host as unavailable. The first client will discover that the host has failed either with next +// keepAlive message or the next request, whichever is earlier. In this case, we will simulate the second +// scenario by sending a new request on first client. The request would fail (since server is down) and +// client should mark the host unavailable. cluster.connect().init(); + +try { +client1.submit("1+1").all().join(); Review comment: If we expect an exception here (i.e. i see it's meant to be ignored) should the test `fail()` if the request succeeds? This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17234594#comment-17234594 ] ASF GitHub Bot commented on TINKERPOP-2445: --- spmallette commented on a change in pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360#discussion_r526069372 ## File path: pom.xml ## @@ -721,6 +722,18 @@ limitations under the License. + Review comment: I'm not sure what the implications are but i just checked to see if you could mock `final` classes with just mockito and came across this: https://www.baeldung.com/mockito-final any chance that will suffice rather than adding another testing dependency. definitely don't want to make things harder but every new bit of testing syntax seems to make it harder to get to junit5 without tons of adapters and shims (even powermock holds a `powermock-module-junit4`. Anyway, if it can't be done without the additional dependency or you see a bigger plan for testing with powermock in the future, then I suppose it's fine to keep it, otherwise my preference would be to try to do it with the test modules we already have. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17233920#comment-17233920 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya commented on pull request #1355: URL: https://github.com/apache/tinkerpop/pull/1355#issuecomment-729174343 Dev mailing list discussion for this breaking change: https://lists.apache.org/thread.html/r9bc162d489d61fcf32184cf7e45f9e06f34daa0970ac20dc09304b95%40%3Cdev.tinkerpop.apache.org%3E This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17233892#comment-17233892 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya opened a new pull request #1360: URL: https://github.com/apache/tinkerpop/pull/1360 https://issues.apache.org/jira/browse/TINKERPOP-2445 ## Changes 1. Create connections in a connection pool simultaneously instead of serially. 1. Create connection pools simultaneously for multiple host endpoints instead of serially. 1. Add a new exception `NoHostAvailableException` for cases when no host with active connections is available to send the query. This replaces TimeoutConnection which was confusing earlier. 1. Do not try to reconnect to host if the connection pool initialization to that host has failed. Attempt to reconnect requires connection but we have a failure in the constructor of connection pool itself. Log the exception and don't add host in load balancer. 1. Added powermock dependency for mocking a new constructor inside a final class. 1. Changed some String.format to concatenation as the former is adding latency during client initialization. 1. Changed `ConnectionException` to extend `RuntimeException`. This simplifies exception handling. Prior to this we had to do multiple wrap and unwraps, hence, adding unnecessary values to the stack trace. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17228579#comment-17228579 ] ASF GitHub Bot commented on TINKERPOP-2445: --- spmallette commented on pull request #1355: URL: https://github.com/apache/tinkerpop/pull/1355#issuecomment-724009038 I think that the value of the speed improvement here is worth the removal and the possible breaking change. The scope of the "break" itself seems fairly narrow and isolated - this will not affect a lot of users (if any). If I want to take a breaking change like this within patch versions I usually just email the dev list with a DISCUSS thread and explain the reasoning/scope for the breaking change (I sometimes even email the user list if i feel it is of effect to a large number of users who might want to have an objection but i don't think that's necessary for this change). I then end the dev list post with a statement of a "72 hour lazy consensus in effect" and then link the DISCUSS thread in the JIRA. I don't think this change needs Upgrade Documentation, but a CHANGELOG entry would be good. Note that these initializations have already been removed on `master` iirc. Assuming all that is in place, then VOTE +1 This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Labels: breaking > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17227931#comment-17227931 ] ASF GitHub Bot commented on TINKERPOP-2445: --- divijvaidya opened a new pull request #1355: URL: https://github.com/apache/tinkerpop/pull/1355 https://issues.apache.org/jira/browse/TINKERPOP-2445 ## Change Remove deprecated methods. ## Motivation Initialization of GraphsonV1.0 is a major contributor (~28%) to initialize a client with a single connection. This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)
[jira] [Commented] (TINKERPOP-2445) Speed up client initialization
[ https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=17213265#comment-17213265 ] Borys Pierov commented on TINKERPOP-2445: - This is very important for the project I work on. The service has to communicate with a large number of graph database instances (AWS Neptune, FWIW) - such, that caching "cluster" objects is not feasible. We tried creating cluster objects on the fly but current overhead is between 600ms-1s with the following code: {code:java} Cluster connectCluster(String endpoitn, int port) { Cluster cluster = Cluster.build() .addContactPoint(endpoint) .port(port) .enableSsl(true) .minConnectionPoolSize(1) .maxConnectionPoolSize(1) .channelizer(SigV4WebSocketChannelizer.class) .serializer(Serializers.GRAPHBINARY_V1D0) .maxWaitForConnection((int) TimeUnit.SECONDS.toMillis(2)) .reconnectInterval(500) .maxContentLength(1024000) .create(); // force it to actually establish a connection cluster.connect(); return cluster; } {code} Besides that, what we found is that even after the above, the very 1st request takes way longer than any of subsequent ones. So we started "priming" the connection by executing a bogus traversal like below: {code} GraphTraversalSource createCluster(String endpoitn, int port) { Cluster cluster = connectCluster(endpoint, port); GraphTraversalSource g = AnonymousTraversalSource.traversal() .withRemote(DriverRemoteConnection.using(cluster)); primeCluster(g); return g; } void primeCluster(GraphTraversalSource g) { g .V() .limit(1) .next(); } {code} Here is a typical tracing sample of the above code execution. There are outliers that take longer that that, but on average - that's what we see for "connecting" and "priming". !screenshot-1.png! >From our perspective, we just need a way to communicate with an arbitrary >number of clusters without that much of overhead - would that be through >optimizing the WSS client, or being able to execute traversal bytecode via >HTTPS. > Speed up client initialization > -- > > Key: TINKERPOP-2445 > URL: https://issues.apache.org/jira/browse/TINKERPOP-2445 > Project: TinkerPop > Issue Type: Improvement > Components: driver >Affects Versions: 3.5.0, 3.4.8 >Reporter: Divij Vaidya >Priority: Minor > Attachments: screenshot-1.png > > > The current Java client has a lot of initialization overhead. Some of the > things we could do to trim the fat are: > 1. Parallelize the connection creation inside a connection pool, i.e. make > [this for > loop|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/ConnectionPool.java] > parallel. > 2. Do not create a bootstrap [for every > connection|https://github.com/apache/tinkerpop/blob/3.4-dev/gremlin-driver/src/main/java/org/apache/tinkerpop/gremlin/driver/Connection.java#L111]. > A single bootstrap could be reused. > 3. Remove SASL Handler from the pipeline after negotiation is complete for a > connection. > 4. Do not initialize SASL Handler if not required. > As part of this task, we should profile the start-up time and identify other > places where we could optimize the start-up time. -- This message was sent by Atlassian Jira (v8.3.4#803005)