neo4j广度第一次遍历内存问题

时间:2015-04-06 14:20:29

标签: optimization graph neo4j graph-databases internals

我有一个包含百万个节点和300万个边缘加载到Neo4j中的图表。它在进行广泛的首次遍历时崩溃,抱怨8 GB机器上的内存不足。每个节点标签字符串的平均长度为40个字符。

Neo4j使用哪种内部表示需要如此多的内存,尤其是进行遍历?鉴于Neo4j能够表示整个图形,为什么在尝试维护广度优先遍历所需的访问节点集时会失败。

根据我的理解,邻接列表格式的上图的图形表示应为MB。 计算假设节点和边的64位表示

  • 300万边* 8字节* 3 = 72 M(节点链接节点)
  • 100万个节点*(40 + 8 + 8个字节)= 56 M(64位哈希链接到节点字符串标签)

2 个答案:

答案 0 :(得分:2)

答案 1 :(得分:0)

bingo @ brian-underwood!你是对的。

我没有配置Neo4J来使用更多内存。

由于该问题仅与节点有关,因此以下是我修改的内容

  • neostore.nodestore.db.mapped_memory = 256M#increase
  • neostore.relationshipstore.db.mapped_memory = 3G #infined
  • neostore.propertystore.db.mapped_memory = 256M#increase
  • neostore.propertystore.db.strings.mapped_memory = 200M #infined
  • neostore.propertystore.db.arrays.mapped_memory = 200M #infined

同时启用,自动索引节点及其键

  • node_auto_indexing = true
  • node_keys_indexable = KEY_NAME