简体   繁体   English

并发写入titan DB以提高性能

[英]Concurrent write to titan DB to improve performance

What is the way for concurrent write to Titan DB as like Cassandra does. 像Cassandra一样,对Titan Titan进行并发写入的方式是什么。 Am using Titan with Cassandra as data storage. 我正在将Titan与Cassandra一起用作数据存储。 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. 我试图用Java多线程来做到这一点,但是却得到了锁异常。

This question was asked in the Aurelius Graphs mailing list: 在Aurelius Graphs邮件列表中提出了以下问题:

https://groups.google.com/d/msg/aureliusgraphs/LbOx0wKhULc/j2wQuBtRqTQJ 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. 您可以使用多线程,处理多个JVM等以并行方式写入Titan。 However, if your Titan schema uses locks to enforce uniqueness, you will inevitably hit locking exceptions. 但是,如果Titan模式使用锁来强制执行唯一性,则不可避免地会遇到锁异常。 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 自己删除锁并管理唯一性一致性: http : //s3.thinkaurelius.com/docs/titan/0.5.4/eventual-consistency.html
  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. 您也可以考虑使用较小的提交,以使锁保持打开状态的时间最短,以防止进一步的锁争用。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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