how to do bulk updating a graph via java api


Dilan Ranasinghe <dila...@...>
 

Hi,

I'm performing a graph update via janugraph java api.

I get around 1000 graph update at once.
So what i do is updating graph in a loop as below.

JanusGraphTransaction tx = janusGraph.newTransaction();
for(String key:keyList){

String[] arry = key.split("#");
String instructionId = arry[0];
String transactionId = arry[1];
long updateStart = System.currentTimeMillis();
tx.traversal().V().has(NODE_TYPE_INSTRUCTION, ID_TYPE_INSTRUCTION, instructionId).out(EDGE_IT).has(ID_TYPE_TRANSACTION, transactionId).next().property(PARAM_0, CHANGED_PARAM_VAL);
long timeToUpdate = System.currentTimeMillis() - updateStart;
LOGGER.info("Updated in " + timeToUpdate +" " + instructionId + ":" + transactionId);
}
tx.commit();

In the log for updates i see that some updates take around 1-2 seconds while some updates are done within 10 milliseconds.

Can you please clarify me the reason for time difference?

Is there any better way to do bulk updates in Java api?

What i assumed was when i use a transaction boundary as above the updates will not go to back-end till i commit. But if that is so there can't be any time difference shown.
So what is the behavior here?

Thanks
Dilan.

Join janusgraph-users@lists.lfaidata.foundation to automatically receive all group messages.