KayV
KayV

Reputation: 13835

Janusgraph : Cassandra thrift timeout exception

I am using Janusgraph in embedded format with backend as cassandrathrift. Here are my properties for janusgraph and cassandra:

storage.backend=cassandrathrift
storage.cassandra.keyspace=t_graph
storage.cassandra.frame-size-mb=128
storage.hostname=10.XX.XX.XX,20.XX.XX.XX,30.XX.XX.XX

And i have a query which finds out the followers count of a particular vertex. Here is the code for that:

public class FollowCountNormal {

    private static JanusGraph graph;
    private static GraphTraversalSource traversalSource;

    public static void main(String[] args) {
        create();
        System.exit(0);
    }

    public static JanusGraph create() {

        graph = JanusGraphFactory.open("/resources/jp.properties");
        traversalSource = graph.traversal();
        getAllEdges();
        return graph;
    }

    static long getAllEdges(){

        try{
            GraphTraversal<Vertex, Vertex> allV = traversalSource.V();
            GraphTraversal<Vertex, Vertex> gt = allV.has("vid", "supernode");
            GraphTraversal<Vertex, Long> c = gt.inE()           
                    .count();
            long l = c.next();
            System.out.println("All edges = "+l);
            graph.tx().commit();
            return l;
        }catch (Exception e) {
            System.out.println("Error while fetching the edges for : ");
            e.printStackTrace();
        }

        return -1;
    }
}

This code works fine if the vertex have a limited number of incoming Edges (i.e. works fine is follower count is less than 100000). But if the followers count is in millions, i got the following exception:

Caused by: org.janusgraph.diskstorage.PermanentBackendException: Permanent failure in storage backend at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.convertException(CassandraThriftKeyColumnValueStore.java:263) at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getNamesSlice(CassandraThriftKeyColumnValueStore.java:162) at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getNamesSlice(CassandraThriftKeyColumnValueStore.java:105) at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getSlice(CassandraThriftKeyColumnValueStore.java:94) at org.janusgraph.diskstorage.keycolumnvalue.KCVSProxy.getSlice(KCVSProxy.java:77) at org.janusgraph.diskstorage.keycolumnvalue.cache.ExpirationKCVSCache$2.call(ExpirationKCVSCache.java:100) at org.janusgraph.diskstorage.keycolumnvalue.cache.ExpirationKCVSCache$2.call(ExpirationKCVSCache.java:96) at com.google.common.cache.LocalCache$LocalManualCache$1.load(LocalCache.java:4742) at com.google.common.cache.LocalCache$LoadingValueReference.loadFuture(LocalCache.java:3527) at com.google.common.cache.LocalCache$Segment.loadSync(LocalCache.java:2319) ... 50 common frames omitted Caused by: org.apache.cassandra.thrift.TimedOutException: null at org.apache.cassandra.thrift.Cassandra$multiget_slice_result$multiget_slice_resultStandardScheme.read(Cassandra.java:14696) at org.apache.cassandra.thrift.Cassandra$multiget_slice_result$multiget_slice_resultStandardScheme.read(Cassandra.java:14633) at org.apache.cassandra.thrift.Cassandra$multiget_slice_result.read(Cassandra.java:14559) at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:78) at org.apache.cassandra.thrift.Cassandra$Client.recv_multiget_slice(Cassandra.java:741) at org.apache.cassandra.thrift.Cassandra$Client.multiget_slice(Cassandra.java:725) at org.janusgraph.diskstorage.cassandra.thrift.CassandraThriftKeyColumnValueStore.getNamesSlice(CassandraThriftKeyColumnValueStore.java:143) ... 58 common frames omitted

I looked for many posts online like this:

link1

but no solution worked for me. Any suggestion on how to solve this?

Upvotes: 1

Views: 363

Answers (1)

KayV
KayV

Reputation: 13835

Changing the storage backend to cql and other properties relevant to cql solved the issue for me. Here are the properties which i used:

storage.backend=cql
storage.cql.keyspace=t_graph
storage.cql.read-consistency-level=ONE

Upvotes: 1

Related Questions