Search code examples
memgraphdb

How to control total Memgraph RAM usage?


Since Memgraph is in RAM memory, how can you control Memgraph total RAM memory usage?

It looks like storage, procedure calls, and queries all take part of the available RAM.


Solution

  • Memgraph memory usage can be impacted by storage, queries, and procedure calls.

    By setting the --memory-limit flag in the Memgraph configuration file, you can set the maximum amount of memory (in MiB) that a Memgraph instance can allocate during its runtime. If the memory limit is exceeded, only the queries that don't require additional memory are allowed. If the memory limit is exceeded while a query is running, the query is aborted, and its transaction becomes invalid.

    The main Memgraph configuration file is available in /etc/memgraph/memgraph.conf.

    There are also more granular controls for setting limits for each Query or Procedure call, but more details can be found in docs for controlling memory usage.