Neo4j memory recommendations

Updated on December 10th, 2022

On busy systems, especially those supporting the use of Analytics, Neo4j can be memory hungry. For that reason, Neo4j provides a tool for the memory heap size recommendation -the neo4j-admin memrec command. This can be run prior to a new deployment going live, or to tune an existing Neo4j deployment. 

We recommend this procedure for Analytics 1.2 onwards.

Care should be taken to make sure that sufficient memory remains for any additional processes/services deployed onto the same server as the Neo4j, otherwise, the memory consumption by Neo4j can become even higher as memrec appears to assume that the Neo4j is running on a dedicated machine. If you choose to make manual RAM adjustments in this way then you should consider using values adjusted from those returned by the memrec command downwards according to the percentage of free to total RAM available.

Alternatively, you should review the amount of RAM installed on the machine that the Analytics service is running on. If, for example, Analytics is running on the same machine as Curator Server and that machine has the recommended 64Gb of RAM installed, consider upping the RAM resources on that machine so that it can meet the additional recommended RAM settings returned by memrec.

  1. Open a Command Line window.
  2. cd to the <neo4j installation directory>\bin directory (e.g. C:\neo4j-community-4.4.3\bin).
  3. Run the "neo4j-admin memrec" command.
  4. Find the following lines in the output:
        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=xxxxxm
        dbms.memory.heap.max_size=xxxxxm
        dbms.memory.pagecache.size=xxxxxm
  5. Go to the <neo4j installation directory>\conf directory.
  6. Edit the neo4j.conf file - Set = values according to the recommended values in the "neo4j-admin memrec" command output above (remove # if necessary) adjusted downwards according to the percentage of free to total RAM available for:
    dbms.memory.heap.initial_size
    dbms.memory.heap.max_size
    dbms.memory.pagecache.size
  7. Save the neo4j.conf file.
  8. Restart the IPV Analytics Services.
  9. To view and debug the neo4j memory usage, browse to https://halin.graphapp.io, providing Neo4j connection details.


 

Was this article helpful?