简体   繁体   中英

Concurrent write to titan DB to improve performance

What is the way for concurrent write to Titan DB as like Cassandra does. Am using Titan with Cassandra as data storage. Overall I want to write to the database parallely so that I can improve the performance.

I tried to do this with java multithread but am getting lock exception.

This question was asked in the Aurelius Graphs mailing list:

https://groups.google.com/d/msg/aureliusgraphs/LbOx0wKhULc/j2wQuBtRqTQJ

Other answers are welcome here, of course, however here is the summary of my answer from that exchange:

You can use multithreading, multiple JVM processed, etc. to write to Titan in a parallel fashion. However, if your Titan schema uses locks to enforce uniqueness, you will inevitably hit locking exceptions. There are two ways to deal with this:

  1. Remove locks and manage uniqueness consistency yourself: http://s3.thinkaurelius.com/docs/titan/0.5.4/eventual-consistency.html OR
  2. Keep locking enabled and add transaction retry to your code. You may also consider smaller commits to keep locks open for the least amount of time possible preventing further lock contention.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM