Increase Heap Space Available for JVM: OutOfMemoryError: Requested array size exceed VM limit Ubuntu 64Bit Neo4j 2.0

StackOverflow https://stackoverflow.com/questions/22717508

Pregunta

My specs:

-Ubuntu 64bit

-Neo4j 2.0

-32 GB of Ram

-AMD FX-8350 Eight COre Processor

The problem:

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

MATCH (being:my_label_2) RETURN being

And gives me this error:

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)

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

What I believe is the problem:

I don't have enough memory allocated to my JVM

Attempts made to fix/things I've found online:

I read what the manual says to do

And what the Ubuntu Forums say to do

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

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

Question

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?

¿Fue útil?

Solución

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

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top