Search code examples
gremlin-serverjanusgraph

There are high availability on the GremlinServers


Reading the documentation of Janusgraph, I understand that high availability only exists in the storage system or backend. (Cassandra). But, is there high availability on the GremlinServers?

For example in mode 16.3. Remote server Mode with Gremlin server. I understand that the wheel with teeth is my application

architecture image

If I have a power outage in a Gremlin Server the two servers connected to the gremlinserver would not have service. There are no Failover or fault tolerane features in gremlinserver?

I use a property file with two parameters:

GremlinServerHost = 127.0.0.1
GremlinServerPort = 8182

Set spring with DI

<bean id="gremlinCluster" class="[FQDN].pool.GremlinCluster" scope="singleton" destroy-method="destroy">
    <constructor-arg name="server"><value>${GremlinServerHost}</value></constructor-arg>
    <constructor-arg name="port"><value>${GremlinServerPort}</value></constructor-arg>
</bean>

private Cluster init() {
..
..
        Cluster cluster = Cluster.build(server).port(port)
..
;

..

And an implementation

Cluster cluster = gremlinCluster.getCluster();
        Client client = null;
        try {
            client = cluster.connect();
            String gremlin = "[Query Gremlin ...   ]"

Solution

  • Gremlin Server instances don't have knowledge of each other, however depending on how you have configured your TinkerPop driver in your application you will get some level of failover in the sense that if the driver finds a dead server it will take note of that and then only send requests to the other available servers you configured. In the background it will continually try to reconnect to the dead server and if it comes back online will include it in the pool of server to which it will send requests.

    So, in the scenario you posed as long as there is an available server, your application shouldn't know the difference. Of course, that means that the remaining active servers will be taking the load of other parts of the application.

    Note that if you are using sessions with your driver, the session will be lost for the server that has gone down. Session information is not shared among Gremlin Server instances. So to get any form of high availability you would need to ensure you use sessionless communication.