Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

customized configuration of java heap size #72

Closed
wyhhyw opened this issue Dec 13, 2016 · 10 comments
Closed

customized configuration of java heap size #72

wyhhyw opened this issue Dec 13, 2016 · 10 comments

Comments

@wyhhyw
Copy link

wyhhyw commented Dec 13, 2016

I'm using the docker neo4j as my graph database. However, when I make some Cypher queries, it always runs to "java heap space" error. And I tried to change the configure file under $neo4j/conf dir, which contains two files: neo4j.conf and neo4j-wrapper.conf. I changed the neo4j-wrapper.conf to enlarge the dbms.memory.heap.initial_size=2048 and dbms.memory.heap.max_size=4096. But when I start the container again, it was modified to the original one again. What can I do to make the memory size be larger?

@wyhhyw
Copy link
Author

wyhhyw commented Dec 13, 2016

OK. I have found solutions here. However, even these official solutions, it seems useless when using --env=NEO4J_dbms_memory_heap_maxSize=4G. The values in conf files were changed again to 512M.

@wyhhyw wyhhyw closed this as completed Dec 13, 2016
@wyhhyw wyhhyw reopened this Dec 13, 2016
@benbc
Copy link
Contributor

benbc commented Dec 15, 2016

@WangAllen What does the command that you use to start the container look like?

@wyhhyw
Copy link
Author

wyhhyw commented Dec 19, 2016

I ran the docker with this: docker run -d --name neo4j --publish=7474:7474 --volume=$HOME/neo4j/data:/data --env=NEO4J_dbms_memory_pagecache_size=2G --env=NEO4J_dbms_memory_heap_maxsize=4G neo4j. The container runs but the heap size is still 512M.

@benbc
Copy link
Contributor

benbc commented Dec 19, 2016

@WangAllen Thanks. It would be helpful if you could try again with a precise label rather than relying on latest; that way we have more chance of reproducing your problem.

@wyhhyw
Copy link
Author

wyhhyw commented Dec 20, 2016

Yeah, I used the CE V3.0.6 version and the docker version is 1.6.2 on Ubuntu 15.04 (GNU/Linux 3.19.0-15-generic x86_64) platform.

@wyhhyw wyhhyw closed this as completed Dec 27, 2016
@mbsimonovic
Copy link

mbsimonovic commented Feb 15, 2017

How did you fix this? i'm having the same issue on ubuntu 16, docker 1.13, neo 2.3.7 community (neo4j 3.1.1 picks up these variables correctly):

$ docker run  -d -P --name neo --env=NEO4J_AUTH=none --env=NEO4J_dbms_memory_pagecache_size=1G --env=NEO4J_dbms_memory_heap_maxSize=2G  neo4j:2.3.7
$ docker exec -it neo bash -c 'ps axu | grep Xmx' 
root          1 80.1 11.2 3068368 323476 ?      Ssl  09:55   0:23 /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java -cp /var/lib/neo4j/lib/ _<skip>_  slf4j-api-1.7.6.jar:/var/lib/neo4j/conf -server -XX:+DisableExplicitGC -Dorg.neo4j.server.properties=conf/neo4j-server.properties -Dlog4j.configuration=file:conf/log4j.properties -XX:+UseG1GC -XX:-OmitStackTraceInFastThrow -XX:hashCode=5 -Dneo4j.ext.udc.source=docker -Xms512m -Xmx512m -Dneo4j.home=/var/lib/neo4j -Dneo4j.instance=/var/lib/neo4j -Dfile.encoding=UTF-8 org.neo4j.server.CommunityBootstrapper

So despite --env=NEO4J_dbms_memory_heap_maxSize=2G, the server gets -Xmx512m. NEO4J_AUTH=none is however correctly applied.

@spacecowboy
Copy link
Contributor

spacecowboy commented Feb 15, 2017

@mbsimonovic In 2.3 the environment variables are different:

https://github.com/neo4j/docker-neo4j/blob/master/src/2.3/docker-entrypoint.sh#L22

use NEO4J_CACHE_MEMORY and NEO4J_HEAP_MEMORY instead of NEO4J_dbms_memory_pagecache_size and NEO4J_dbms_memory_heap_maxSize

This described in the 2.3 manual: https://neo4j.com/developer/docker-23/

@mbsimonovic
Copy link

@spacecowboy thanks! Maybe the docs should be updated.

@hthetiot
Copy link

This does not work using latest or 3.0.
Works with 2.3 image version so far.

@EricGT
Copy link

EricGT commented Aug 23, 2018

With regards to

This does not work using latest or 3.0.

Currently running Neo4j Enterprise 3.4.6 via Docker on Windows 10 [Version 10.0.17134.228]

Have same problem where mounted config directory,
--volume=C:\Users\Eric\Documents/neo4j/conf:/conf with config file neo4j.conf is ignored.

However using command line options with docker run command to change config values works,
e.g. --env=NEO4J_dbms_memory_heap_initial__size=512m --env=NEO4J_dbms_memory_heap_max__size=2G

This can be verified in cypher-shell

neo4j> CALL dbms.listConfig("heap");

+----------------------------------------------------------------------------------------------------------------------------------+
| name                            | description                                                                           | value  |
+----------------------------------------------------------------------------------------------------------------------------------+
| "dbms.memory.heap.initial_size" | "Initial heap size. By default it is calculated based on available system resources." | "512m" |
| "dbms.memory.heap.max_size"     | "Maximum heap size. By default it is calculated based on available system resources." | "2G"   |
+----------------------------------------------------------------------------------------------------------------------------------+

2 rows available after 399 ms, consumed after another 5 ms

Note that while the command line argument names appear to be the same as in Configuration settings take care to read the Neo4j Operations Manual when using Docker; see section 2.5.3.1. Environment variables

Any configuration value (see Section A.1, “Configuration settings”) can be passed using the following naming scheme:
Prefix with NEO4J_.
Underscores must be written twice: _ is written as __.
Periods are converted to underscores: . is written as _.

It would be nice if these important notes were in more than one place, but then again when important notes are in several places, they do not always get updated consistently and then in the future when you find conflicting notes it can be harder to understand.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants