Memory recommendations

This chapter describes the memrec command of Neo4j Admin.

Use the memrec command of neo4j-admin to get an initial recommendation on how to configure memory parameters for Neo4j:

neo4j-admin memrec --memory=<memory dedicated to Neo4j>, --verbose, --docker

The command gives heuristic memory setting recommendations for the Neo4j JVM heap and pagecache. The heuristic is based on the total memory of the system the command is running on, or on the amount of memory specified with the --memory argument. The heuristic assumes that the system is dedicated to running Neo4j. If this is not the case, then use the --memory argument to specify how much memory can be expected to be dedicated to Neo4j. The default output is formatted as such that it can be copy-pasted into neo4j.conf. The argument --docker outputs environmental variables that can be passed to a Neo4j docker container. For a detailed example, see Use Neo4j Admin for memory recommendations.

Options

Option Default Description

--memory=<size>

The memory capacity of the machine.

The amount of memory to allocate to Neo4j. Valid units are: k, K, m, M, g, G.

--verbose

Enable verbose output.

--docker

Enable output formatted as environmental variables that can be passed to a Neo4j docker container.

Considerations

The neo4j-admin memrec command calculates a valid starting point for Neo4j memory settings, based on the provided memory. The specific conditions for your use case may warrant adjustment of these values. See Memory configuration for a description of the memory settings in Neo4j.

Example 1. Use the memrec command of neo4j-admin

The following example illustrates how neo4j-admin memrec provides a recommendation on how to use 16g of memory:

$neo4j-home> bin/neo4j-admin memrec --memory=16g

...
...
...
# Based on the above, the following memory settings are recommended:
dbms.memory.heap.initial_size=5g
dbms.memory.heap.max_size=5g
dbms.memory.pagecache.size=7g
For an example on how to use the neo4j-admin memrec command, see Inspect the memory settings of all databases in a DBMS.