Alaa Mahmoud
Alaa Mahmoud

Reputation: 743

How to speed up bulk operations in IBM Graph

I'm trying to populate my graph on IBM Graph service using gremlin queries. I'm using addVertex and I'm doing it in batches. The gremlin I'm using looks like this and it seems slow

{"gremlin": 
    "def g = graph.traversal(); 
    graph.addVertex(T.label, "foo")";
    .
    .
    .
}

Is there a way to speed this up

Upvotes: 1

Views: 123

Answers (1)

Alaa Mahmoud
Alaa Mahmoud

Reputation: 743

The problem with this script is that it will be compiled every time and that takes time. If you have 100's of these then the time to compile each one will definitely add up. A Better way to do is to write the script once and then bind the variables in a bindings object.

{
  "gremlin": "def g = graph.traversal();graph.addVertex(T.label, name)",
  "bindings": { "name": "foo" }
}

This technique will pretty much work with any database that's built on top of Tinkerpop and uses Gremlin as a DSL

Upvotes: 1

Related Questions