3

I am using gremlin server with hbase as storage.bakend.

When I try to connect to the gremlin server from my spark code,the below message gets logged and after sometime it timeouts.

Opening connection pool on Host{address = 'ip:8182' ,, hostUri=ws:/ip:8182/gremlin} with core size of 2

The following code is used to get the client instance for each partition:

private static Cluster cluster;
private static Client client;
Logger logger = LoggerFactory.getLogger(GremlinSeverConnection.class);

public Client getGraph(GraphConf conf) {

 if (client == null) {
    try {
        // cluster = Cluster.build(new File(conf)).create();
        cluster = Cluster.build(conf.getGraphHost()).port(Integer.parseInt(conf.getGraphPort()))
                .serializer(getserializer(conf.getGraphSerializer())).create();


        client = cluster.connect();

        logger.info("connected to graph database");
    } finally {

        //cluster.close();
        //client.close();
    }
}
    return client;
}

public Serializers getserializer(String serializer) {

    return Serializers.GRAPHSON;
}
Xavier Guihot
  • 54,987
  • 21
  • 291
  • 190
Nithin A
  • 374
  • 1
  • 2
  • 18

1 Answers1

3

You could set the min and max size of the connection pool to 1:

Cluster cluster = Cluster.build().maxConnectionPoolSize(1)
                                  minConnectionPoolSize(1).create();

That should force the client to use a single connection.

stephen mallette
  • 45,298
  • 5
  • 67
  • 135
  • now i am getting ,Opening connection pool on Host{address = 'ip:8182' ,, hostUri=ws:/ip:8182/gremlin} with core size of 1 and again after some time it timeouts – Nithin A May 08 '17 at 12:06
  • 1
    your question was about how to disable the pool. with the settings i provided you now have a single connection which effectively is no pool. why your connections timeout is a different story. Maybe you just need to increase some of the timeout related settings described [here](http://tinkerpop.apache.org/docs/current/reference/#_configuration). – stephen mallette May 08 '17 at 13:01