1

我对 Neo4j 很陌生,并且使用带有 Javascript 驱动程序的 Neo4j 桌面版本。我的图表有大约 30.000 个节点和 40.000 条边。最后一种方法是在图中获取所有简单的循环,但是我在尝试执行以下密码查询时面临堆溢出:

let res = await session.run('MATCH p=(n)-[*2..4]-(n) RETURN nodes(p)')

这当然是因为查询尝试返回找到的所有简单循环,这对我的堆来说非常重要,并且不高兴地增加 node.js 的内存不是一个选项。

那么有什么办法可以绕过这个问题并从图中获取所有简单的循环?

这是我得到的堆溢出错误:

/Users/paulus/.nvm/versions/node/v15.10.0/bin/node /Users/paulus/routeplanner/RouteFinder.js

<--- Last few GCs --->

[39630:0x104e00000]   227813 ms: Scavenge (reduce) 2033.5 (2077.9) -> 2032.1 (2072.1) MB, 113.5 / 0.0 ms  (average mu = 0.577, current mu = 0.321) allocation failure 
[39630:0x104e00000]   228171 ms: Scavenge (reduce) 2036.5 (2072.6) -> 2035.5 (2075.6) MB, 28.6 / 0.0 ms  (average mu = 0.577, current mu = 0.321) allocation failure 
[39630:0x104e00000]   228558 ms: Scavenge (reduce) 2039.1 (2075.6) -> 2038.5 (2080.4) MB, 28.2 / 0.0 ms  (average mu = 0.577, current mu = 0.321) allocation failure 


<--- JS stacktrace --->


<--- Last few GCs --->

[39630:0x104e00000]   227813 ms: Scavenge (reduce) 2033.5 (2077.9) -> 2032.1 (2072.1) MB, 113.5 / 0.0 ms  (average mu = 0.577, current mu = 0.321) allocation failure 
[39630:0x104e00000]   228171 ms: Scavenge (reduce) 2036.5 (2072.6) -> 2035.5 (2075.6) MB, 28.6 / 0.0 ms  (average mu = 0.577, current mu = 0.321) allocation failure 
[39630:0x104e00000]   228558 ms: Scavenge (reduce) 2039.1 (2075.6) -> 2038.5 (2080.4) MB, 28.2 / 0.0 ms  (average mu = 0.577, current mu = 0.321) allocation failure 


<--- JS stacktrace --->

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory
FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory

<--- Last few GCs --->

[39630:0x104e00000]   227813 ms: Scavenge (reduce) 2033.5 (2077.9) -> 2032.1 (2072.1) MB, 113.5 / 0.0 ms  (average mu = 0.577, current mu = 0.321) allocation failure 
[39630:0x104e00000]   228171 ms: Scavenge (reduce) 2036.5 (2072.6) -> 2035.5 (2075.6) MB, 28.6 / 0.0 ms  (average mu = 0.577, current mu = 0.321) allocation failure 
[39630:0x104e00000]   228558 ms: Scavenge (reduce) 2039.1 (2075.6) -> 2038.5 (2080.4) MB, 28.2 / 0.0 ms  (average mu = 0.577, current mu = 0.321) allocation failure 


<--- JS stacktrace --->

FATAL ERROR: MarkCompactCollector: young object promotion failed Allocation failed - JavaScript heap out of memory

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)
4

1 回答 1

1

如果不知道图表的数据模型,很难为您提供准确的解决方案,但它可能有助于使用跳过/限制来获取较小批量的数据。

这将获得前 100 个模式:

MATCH p=(n)-[*2..4]-(n) RETURN nodes(p) SKIP 0 LIMIT 100

这是接下来的 100 个:

MATCH p=(n)-[*2..4]-(n) RETURN nodes(p) SKIP 100 LIMIT 100
于 2021-04-28T11:46:17.017 回答