cancel
Showing results for 
Search instead for 
Did you mean: 

Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.

The optimal setting for the heap memory on AWS for Neo4J 3.5

deemeetree
Graph Buddy

I run Neo4J 3.5 on an AWS EC2 instance.

Suppose the instance has 4Gb of RAM. As I understand, if I leave all the settings default, the neo4j.template (which then becomes neo4j.conf upon launch) allocates about 50% of this RAM to the heap (via dbms.memory.heap.max_size and then about 50% of the remaining (that is, 25%) to dbms.memory.pagecache.size.

But then is the heap memory limited by the maximum heap memory setting in Java? For instance, when I check it using

java -XshowSettings:vm

I can see my max heap is 1G. I can increase it to 2G but will it also make more heap available to Neo4J in the automatic mode?

How can I check, on an instance running on AWS (via systemctl) how much heap was actually allocated upon launch to the neo4j process?

1 REPLY 1

Have you looked at what the neo4j memory recommendation diagnostic recommends? it has some tips and notes as well.

The command is

neo4j-admin memrec

here is an example output of memrec

I have no name!@67d76e91f1c9:/var/lib/neo4j$ neo4j-admin memrec
# Memory settings recommendation from neo4j-admin memrec:
#
# Assuming the system is dedicated to running Neo4j and has 61400m of memory,
# we recommend a heap size of around 23000m, and a page cache of around 26600m,
# and that about 11800m is left for the operating system, and the native memory
# needed by Lucene and Netty.
#
# Tip: If the indexing storage use is high, e.g. there are many indexes or most
# data indexed, then it might advantageous to leave more memory for the
# operating system.
#
# Tip: The more concurrent transactions your workload has and the more updates
# they do, the more heap memory you will need. However, don't allocate more
# than 31g of heap, since this will disable pointer compression, also known as
# "compressed oops", in the JVM and make less effective use of the heap.
#
# Tip: Setting the initial and the max heap size to the same value means the
# JVM will never need to change the heap size. Changing the heap size otherwise
# involves a full GC, which is desirable to avoid.
#
# Based on the above, the following memory settings are recommended:
dbms.memory.heap.initial_size=23000m
dbms.memory.heap.max_size=23000m
dbms.memory.pagecache.size=26600m

note: This neo4j is running on an AWS EC2 host with 64g of ram but inside a docker container, which is why it says "I have no name!" where we usually see the hostname. I shelled into the container to run the memrec command.