[ 
https://issues.apache.org/jira/browse/TINKERPOP-2445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=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)

Reply via email to