Neo4j嵌入java内存不足(缓存有问题)

时间:2014-06-02 06:39:14

标签: java neo4j blueprint

在我的研究项目中,我将整个图形数据划分为多个部分,并将每个部分存储在自己的graph.db文件夹中 然后,我可能同时将10或15个graph.db加载到内存中(新的Neo4jGraph(/path/to/graph.db),我使用blueprint api),因为我想遍历图的这些部分,这意味着我在这个graph.db中找不到我想要的节点。我会尝试在其他graph.db上找到它。

它最初工作正常,但是当它运行一段时间后,它会抛出这些例外:

 Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
  at java.util.concurrent.atomic.AtomicReferenceArray.<init>(AtomicReferenceArray.java:94)
  at org.neo4j.kernel.impl.cache.GCResistantCache.<init>(GCResistantCache.java:89)
  at org.neo4j.kernel.impl.cache.GCResistantCacheProvider.newRelationshipCache(GCResistantCacheProvider.java:75)
  at org.neo4j.kernel.impl.core.DefaultCaches.relationship(DefaultCaches.java:54)
  at org.neo4j.kernel.InternalAbstractGraphDatabase.create(InternalAbstractGraphDatabase.java:458)
  at org.neo4j.kernel.InternalAbstractGraphDatabase.run(InternalAbstractGraphDatabase.java:256)
  at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:106)
  at org.neo4j.kernel.EmbeddedGraphDatabase.<init>(EmbeddedGraphDatabase.java:81)
  at com.tinkerpop.blueprints.impls.neo4j.Neo4jGraph.<init>(Neo4jGraph.java:153)
  at netdb.graph.unit.CacheManager.loadGraphToCache(CacheManager.java:125)
  at netdb.graph.unit.CacheManager.findVertexInCache(CacheManager.java:67)
  at netdb.graph.opts.framework.IndexedGraph.query(IndexedGraph.java:47)
  at netdb.graph.opts.framework.run.OptsExecutor.run(OptsExecutor.java:62)
  at netdb.graph.opts.framework.run.OptsExecutor.main(OptsExecutor.java:129)

顺便说一句,这是我的jvm设置:

java -jar -Xmx90G -XX:+UseConcMarkSweepGC -XX:+UseParNewGC -XX:+UseNUMA

和neo4j.propertise:

neostore.nodestore.db.mapped_memory=15G
neostore.relationshipstore.db.mapped_memory=30G
neostore.propertystore.db.mapped_memory=50G
neostore.propertystore.db.strings.mapped_memory=2G
neostore.propertystore.db.arrays.mapped_memory=2G

有谁知道我应该在哪里研究?我该如何避免这些错误? 欢迎任何建议

非常感谢!

--------------更新代码片段----------
my code snippet
也许看看方法loadGraphToCache

0 个答案:

没有答案