Memory recommendations

You can use the neo4j-admin server memory-recommendation command to get an initial recommendation on how to configure the memory parameters of your Neo4j DBMS.

Syntax

The neo4j-admin server memory-recommendation command has the following syntax:

neo4j-admin server memory-recommendation [-h] [--docker] [--expand-commands]
                                         [--verbose] [--additional-config=<file>]
                                         [--memory=<size>]

Description

The command prints heuristic memory settings recommendations for the Neo4j JVM heap and pagecache. It either uses the total system memory or the amount of memory specified in 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 output is formatted such that it can be copy-pasted into the neo4j.conf file.

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

The neo4j-admin server memory-recommendation command has the following options:

Table 1. neo4j-admin server memory-recommendation options
Option Description Default

--additional-config=<file>[1]

Configuration file with additional configuration.

--docker

The recommended memory settings are produced in the form of environment variables that can be directly passed to a Neo4j docker container. The recommended use is to save the generated environment variables to a file and pass the file to a docker container using the --env-file docker option.

--expand-commands

Allow command expansion in config value evaluation.

-h, --help

Show this help message and exit.

--memory=<size>

Recommend memory settings with respect to the given amount of memory, instead of the total memory of the system running the command. Valid units are: k, K, m, M, g, G.

The memory capacity of the machine.

--verbose

Enable verbose output.

1. See Tools → Configuration for details.

Considerations

The neo4j-admin server memory-recommendation command calculates a valid starting point for the 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

Example 1. Use the memory-recommendation command of neo4j-admin

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

bin/neo4j-admin server memory-recommendation --memory=16g

...
...
...
# Based on the above, the following memory settings are recommended:
server.memory.heap.initial_size=5g
server.memory.heap.max_size=5g
server.memory.pagecache.size=7g

For an example of how to use the neo4j-admin server memory-recommendation command, see Inspect the memory settings of all databases in a DBMS.