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>]

The command gives 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 also 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 so you can copy and paste it 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

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

Table 1. Options
Option Default Description

-h, --help

Show this help message and exit.

--docker

Enable output formatted as environmental variables that can be passed to a Neo4j Docker container. The recommended use is to save the generated environment variables to a file and pass that file to a Docker container using --env-file Docker option.

--expand-commands

Expand the commands to be run.

--verbose

Enable verbose output.

--additional-config

<file>

Configuration file to supply additional configuration in.

--memory

<size> (Default: The memory capacity of the machine.)

Recommend memory settings for 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.

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.