我应该使用 JanusGraph 作为主数据库来存储新项目的所有数据吗?

Should I use JanusGraph as main database to store all my data for a new project?

我正在考虑学习 JanusGraph 以在我的新大项目中使用,但我无法理解某些事情。

Janus 可以像任何数据库一样使用,支持 "insert"、"update"、"delete" 操作,因此 JanusGraph 会将数据写入 Cassandra 或其他数据库来存储这些数据,对吧?

JanusGraph 存储节点、边、属性等的地方,它会将这些写入数据库,对吗?

这些数据应该由Janus加载到内存中还是会一直从Cassandra中读取?

JanusGraph 读取的数据必须在每个查询中加载到 JanusGraph 中,否则它会在数据库中进行选择以检索我需要的数据?

数据库中检索到的数据只是我需要的,还是 Janus 会一直读取数据库中的所有记录?

我应该在我的生产项目中使用 JanusGraph 还是应该等到它准备好生产?

我正在开发某种社交网络,需要存储友谊、帖子、评论、用户块并进行一些弹性搜索,在这种情况下,我应该使用什么数据库后端?

Janus will write data into Cassandra or other database to store these data, right?

Where Janus store the Nodes, Edges, Attributes etc, it will write these into database, right?

Janus Graph 会将数据写入任何 storage backend you configure it to use. This includes Cassandra. It writes this data into the underlaying database using the data model roughly outlined here

These data should be loaded in memory by Janus or will be read from Cassandra all the time?

The data retrieved in database is only what I need or Janus will read all records in database all the time?

Janus Graph 只会将您在 query/traversal 期间接触到的顶点和边加载到内存中。因此,如果您执行以下操作:

graph.traversal().V().hasLabel("My Amazing Label");

Janus 将 读取并加载到内存 label 的顶点。所以你不需要担心初始化一个图连接然后等待整个图序列化到内存中才可以查询。 Janus 是个懒惰的人 reader。

Should I use Janus in my project in production or should I wait until it becomes production ready?

这完全取决于您和您的用例。可以看出,Janus 已经在生产中使用 here at the bottom of the page. Janus was forked from and improved on TitanDB,它也用于多个生产用例。因此,如果您想 "is it ready" 那么我会说是的,鉴于它的现有用途,它显然已经准备就绪。

what database backend should I use?

同样,这完全取决于您。我使用 Cassandra 是因为它可以水平缩放,而且我发现它更易于使用。它似乎也适合所有不同大小的数据。

我玩过Google Big Table,这似乎也很强大。然而,它只真正适合非常大的数据,而且它也只在云上,因为 Cassandra 可以很容易地在本地托管。

我没有在 HBase or BerkeleyDB 中使用过 Janus,所以我不能在那里发表评论。

虽然在后端之间进行更改非常简单(您需要做的就是调整一些配置并检查您的依赖项是否到位),因此在您的开发过程中可以随意使用后端。当您投入生产或对每个后端更有把握时,您才真正需要提交后端。

在考虑将哪种存储后端用于新项目时,重要的是要考虑您希望做出的权衡。在我的个人项目中,我喜欢使用 NoSQL 图形数据库,因为与关系数据库相比具有以下优势

  • 在新项目上快速迭代时无需迁移模式可提高工作效率
  • 遍历高度规范化的 data-model 不像 RDBMS 中的 JOIN 那样昂贵
  • 大多数包含 in-memory 非常适合实验和测试的配置。
  • 支持 multi-machine 集群和分区容错。

以下是用 Kotlin 编写的示例 JanusGraph 和 Neo4j 后端:

JanusGraph 的主要优势在于 pluging-in 您喜欢的任何存储后端的灵活性。