What's the best neo4j.conf memory configuration for a dedicated Neo4J server?

If I'm hosting my Neo4J 3.x DB on an AWS EC2 instance with 2 vCPUs and 4Gb RAM what would be the best setting for these parameters in neo4j.conf:

dbms.memory.heap.initial_size=
dbms.memory.heap.max_size=

dbms.memory.pagecache.size=

I haven't found any conclusive evidence on that in your documentation apart from the fact that the pagecache size should be 50% RAM minus max heap.

But is there a general rule of thumb for these parameters on a machine solely dedicated to Neo4J?

For instance, for the configuration above (2 vCPUs and 4GB RAM = Amazon EC2 t2 instance) dedicated to Neo4J shall I just give all the memory to DB or leave all these parameters commented out and let Neo4J decide on the best parameters by itself?

Hi, You can use the command "neo4j-admin memrec" gives you a recommendation.

Thanks

Thank you, @jggomez. How is it different from the automatic settings provided by Neo4J if you just leave those parameters commented out?

In a machine with such small configuration you might be better off leaving them auto. It becomes more important for larger databases.

Base rules for configuring these properties are

  1. What is the query memory usage. You heap should be big enough for all the memory required for the queries running at any given instance of time. Normally more users mean more heap.

  2. How big is the database and what is the total memory available for page cache. In an ideal world you have enough memory available to put whole DB into memory. Say your DB size is 20GB and you have 20GB memory available after heap, OS and other considerations then System will run optimally. If not you should have enough memory for page cache active data set to reduce the page faults to have decent SLA on queries.

This is when we need to think about how we are allocating memory to heap and page cache. If you have a cluster, then the user load would be distributed across cluster. In that case you could reduce heap and increase page cache up to the size of DB to have best performance.