Neo4J metrics and disk space provisioning

David de los Santos Boix
6 min readJul 15, 2020

When using any piece of software, you will probably need some kind of monitoring and alerting system watching on that software so you can know when is it about to collapse or if it is down. For doing that you will need to enable some metrics of your system to investigate what happened, how to solve the problem and how to prevent this from happening again.

Neo4J is no different from any piece of software, and it comes with the ability to export a bunch of customisable metrics to different systems, so you can visualise, monitor and watch for those values.

To do so, Neo4J provides some configuration properties to be added to the neo4j.conf file, so you can enable the metrics you are interested in, and where they go. Here are some of the Neo4J 4.1 default values regarding metrics on neo4j.conf:

metrics.csv.enabled=true
metrics.csv.interval=3s
metrics.csv.rotation.keep_number=7
metrics.csv.rotation.size=10.00MiB

That means that, by default, Neo4J has CSV metrics enabled, writing to disk every 3 seconds, keeping 7+1 files per CSV it creates (the working CSV and the 7 historic files), being each file up to 10 MiB, but, how does Neo4J spill metrics to disk? Could it be this default configuration a disk space problem? Let’s find out.

Defaults can be dangerous

Neo4J has all the metrics enabled by default, which creates the following file structure inside your metrics folder:

neo4j.bolt.accumulated_processing_time.csv
neo4j.bolt.accumulated_queue_time.csv
neo4j.bolt.connections_closed.csv
neo4j.bolt.connections_idle.csv
neo4j.bolt.connections_opened.csv
neo4j.bolt.connections_running.csv
neo4j.bolt.messages_done.csv
neo4j.bolt.messages_failed.csv
neo4j.bolt.messages_received.csv
neo4j.bolt.messages_started.csv
neo4j.bolt.sessions_started.csv

So, only with metrics.bolt.messages.enabled=true, Neo4J is generating 11 CSV files, one file per metric defined at the metrics reference. That means Neo4J creates a single file for each metric within a metric category. Taking into account that Neo4J has all metrics enabled by default, Neo4J will have 98 CSV files for all its metrics.

David de los Santos Boix
0 Followers

Streaming and Graph Databases enthusiast.