I am in the process of evaluating a number of different graph databases for 
use in an existing application.  This application currently uses Neo4J as 
the repository but we are looking at whether a switch would make sense.  As 
part of the evaluation process, we have created a test harness to perform 
consistent tests across the databases we are evaluating, arangodb being one 
of them.  One of the simple tests we are doing is to add nodes and edges 
individually and in batches since that is how our application would 
interact with the DB.  What I have found is that arango is 5-6 times slower 
than neo4j in doing these tests.  I am currently using the Java driver to 
perform the tests and doing the inserts using the graph api and not the 
generic collection api.  I have been following the arango provided java 
guides for adding the nodes and edges and using e StreamingTransaction api 
for doing the batches so I'm not sure where I could be going too wrong in 
my approach.  With that said, I don't know how arangodb could be that much 
slower than neo4j.

Following are examples of how I am adding the data (this isn't the harness, 
just an example of how we are adding data).  Any feedback as to how I can 
improve the performance would be greatly appreciated.

  private void addEdge(ArangoDB arangoDB)
  {
    ArangoGraph graph = arangoDB.db(DATABASE).graph(GRAPH);
    String[] collections = new String[] {"MY_test_edge"};
    
    StreamTransactionEntity tx = graph.db().beginStreamTransaction(
            new StreamTransactionOptions()
            .waitForSync(false)
            .writeCollections(collections));
    EdgeCreateOptions options = new EdgeCreateOptions()
            .streamTransactionId(tx.getId())
            .waitForSync(false);
    
    System.out.println("Transaction collections: " + String.join(",", 
collections));
    try
    {
      BaseEdgeDocument edge = new 
BaseEdgeDocument("MY_test_vertex_from1/MY_from_key1", 
"MY_test_vertex_to/MY_to_key");
      graph.edgeCollection("MY_test_edge").insertEdge(edge, options);

      edge = new BaseEdgeDocument("MY_test_vertex_from2/MY_from_key2", 
"MY_test_vertex_to/MY_to_key");
      graph.edgeCollection("MY_test_edge").insertEdge(edge, options);
      
      graph.db().commitStreamTransaction(tx.getId());
    }
    catch (Exception e)
    {
      graph.db().abortStreamTransaction(tx.getId());
      throw e;
    }
  }

  private void addNodes(ArangoDB arangoDB)
  {
    ArangoGraph graph = arangoDB.db(DATABASE).graph(GRAPH);
    
    String[] collections = new String[] {"MY_test_vertex_from1", 
"MY_test_vertex_from2", "MY_test_vertex_to"};
    StreamTransactionEntity tx = graph.db().beginStreamTransaction(
            new StreamTransactionOptions()
            .waitForSync(false)
            .writeCollections(collections));
    VertexCreateOptions options = new VertexCreateOptions()
            .streamTransactionId(tx.getId())
            .waitForSync(false);
    try
    {
      graph.vertexCollection("MY_test_vertex_from1").insertVertex(new 
BaseDocument("MY_from_key1"), options);
      graph.vertexCollection("MY_test_vertex_from2").insertVertex(new 
BaseDocument("MY_from_key2"), options);
      graph.vertexCollection("MY_test_vertex_to").insertVertex(new 
BaseDocument("MY_to_key"), options);
      graph.db().commitStreamTransaction(tx.getId());
    }
    catch (Exception e)
    {
      graph.db().abortStreamTransaction(tx.getId());
    }
  }

-- 
You received this message because you are subscribed to the Google Groups 
"ArangoDB" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/arangodb/5ab926f0-2499-4dfb-bb13-6b213901e2c9%40googlegroups.com.

Reply via email to