本文介绍了增加可用于JVM的堆空间:OutOfMemoryError:请求的阵列大小超出VM限制Ubuntu 64Bit Neo4j 2.0的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的规格

-Ubuntu 64位

-Ubuntu 64bit

-Neo4j 2.0

-Neo4j 2.0

-32 GB的Ram

-32 GB of Ram

-AMD FX-8350八核处理器

-AMD FX-8350 Eight COre Processor

问题:

我通过以下查询向Neo4j服务器发出请求:

I'm making a request to my Neo4j server with the following query:

MATCH (being:my_label_2) RETURN being

并给我这个错误:

OutOfMemoryError

Requested array size exceeds VM limit

StackTrace:
java.lang.StringCoding$StringEncoder.encode(StringCoding.java:300)
java.lang.StringCoding.encode(StringCoding.java:344)
java.lang.String.getBytes(String.java:916)
org.neo4j.server.rest.repr.OutputFormat.toBytes(OutputFormat.java:194)
org.neo4j.server.rest.repr.OutputFormat.formatRepresentation(OutputFormat.java:147)
org.neo4j.server.rest.repr.OutputFormat.response(OutputFormat.java:130)
org.neo4j.server.rest.repr.OutputFormat.ok(OutputFormat.java:67)
org.neo4j.server.rest.web.CypherService.cypher(CypherService.java:101)
java.lang.reflect.Method.invoke(Method.java:606)
org.neo4j.server.rest.transactional.TransactionalRequestDispatcher.dispatch(TransactionalRequestDispatcher.java:139)
org.neo4j.server.rest.security.SecurityFilter.doFilter(SecurityFilter.java:112)

这对于"my_label_1"可以很好地返回大约30k的结果

This works fine with "my_label_1" which returns around 30k results

我认为是问题所在:

我没有足够的内存分配给我的JVM

I don't have enough memory allocated to my JVM

尝试修复/我在网上发现的问题:

我阅读了手册中的规定

Ubuntu论坛说要做什么

因此,我尝试进入我的neo4文件夹(与往常一样使用cd)并以这种方式使用参数运行它:

So I've tried going to my neo4 folder (with cd as usual) and running it with the arguments this way:

sudo bin/neo4j start -Xmx4096M

但是那没用. Neo4j启动时,它确实警告我说我可能没有足够的空间.

However that didn't work. When Neo4j starts it does warn me that I might not have enough space with:

WARNING: Max 1024 open files allowed, minimum of 40 000 recommended. See the Neo4j manual.
Using additional JVM arguments:  -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Djava.util.logging.config.file=conf/logging.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled

问题

我知道我肯定使用了错误的参数,说实话我对JVM配置没有太多经验.我应该如何处理?我丢失了什么吗?

I know I'm definitely using the arguments wrong, I honestly don't have much experience with JVM configurations. How should I approach this, am I missing something?

推荐答案

您应将JVM设置放入conf/neo4j-wrapper.conf文件中.它应该看起来像这样:

You should put JVM setting into the conf/neo4j-wrapper.conf file. It should look like this:

user@pc:> head -n 7 neo4j-enterprise-2.0.0/conf/neo4j-wrapper.conf
wrapper.java.additional=-Dorg.neo4j.server.properties=conf/neo4j-server.properties
wrapper.java.additional=-Djava.util.logging.config.file=conf/logging.properties
wrapper.java.additional=-Dlog4j.configuration=file:conf/log4j.properties

# Java Additional Parameters
wrapper.java.additional=-XX:+UseConcMarkSweepGC
wrapper.java.additional=-XX:+CMSClassUnloadingEnabled

请注意,您可以通过不同的文件配置neo4j的不同方面,因此最好阅读该conf/目录中每个文件的描述,以便熟悉可以做什么以及如何精确执行.

Note that you can configure different aspects of neo4j via different files, so it's better to read description to every file in that conf/ directory in order to get familiar with what can be done and how exactly.

这篇关于增加可用于JVM的堆空间:OutOfMemoryError:请求的阵列大小超出VM限制Ubuntu 64Bit Neo4j 2.0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-28 17:38