Speeding up graphs with RRDCacheD

When the graphs are stored with the RRDTool engine, every IP graph update is a small random disk write. RRDCacheD batches these updates in memory and flushes them in bulk, which greatly reduces the disk I/O of the Console server.

RRDTool — even with RRDCacheD — is not fast enough to sustain updating thousands of very-high-granularity IP graphs. If that is your situation, consider switching the Graph Storage Engine to InfluxDB or ClickHouse in Configuration » General Settings » Graphs & Storage instead.
Ubuntu / Debian
  1. Install the packages:
    apt-get install rrdtool rrdcached
  2. Edit /etc/default/rrdcached and set:
    OPTS="-l unix:/var/run/rrdcached.sock -s andrisoft -m 774 -w 3600 -f 7200 -F -b /var/lib/rrdcached/db/"
  3. The ownership and permissions of the socket reset on every service start, so let systemd fix them automatically: run systemctl edit rrdcached and add:
    [Service]
    ExecStartPost=/bin/sh -c "/bin/sleep 2; /bin/chown andrisoft:www-data /var/run/rrdcached.sock; /bin/chmod 770 /var/run/rrdcached.sock"
  4. Enable and start the service:
    systemctl daemon-reload
    systemctl enable --now rrdcached
  5. Add unix:/var/run/rrdcached.sock to the RRDCached Socket field in Configuration » General Settings » Graphs & Storage. The existing IP graphs do not need to be deleted.
Rocky Linux / AlmaLinux / RHEL
  1. Install RRDTool (the rrdcached daemon is included in the rrdtool package):
    dnf install rrdtool
  2. Create the service file /usr/lib/systemd/system/rrdcached.service with the following content:
    [Unit]
    Description=RRDCacheD for Andrisoft
    
    [Service]
    Restart=always
    User=andrisoft
    PermissionsStartOnly=yes
    ExecStartPre=/bin/sh -c "/bin/mkdir -p /var/rrdtool/rrdcached/; /bin/chown andrisoft:andrisoft /var/rrdtool/rrdcached"
    ExecStart=/usr/bin/rrdcached -l unix:/var/rrdtool/rrdcached/rrdcached.sock -s andrisoft -m 774 -w 3600 -g -p /var/rrdtool/rrdcached/rrdcached.pid
    ExecStartPost=/bin/sh -c "/bin/sleep 4; /bin/chown andrisoft:apache /var/rrdtool/rrdcached/rrdcached.sock; /bin/chown andrisoft:andrisoft /var/rrdtool/rrdcached/rrdcached.pid; /bin/chmod 770 /var/rrdtool/rrdcached/rrdcached.sock"
    
    [Install]
    WantedBy=multi-user.target
  3. Enable and start the service:
    systemctl daemon-reload
    systemctl enable --now rrdcached
  4. Add unix:/var/rrdtool/rrdcached/rrdcached.sock to the RRDCached Socket field in Configuration » General Settings » Graphs & Storage. The existing IP graphs do not need to be deleted.
Checking that it works

You can watch RRDCacheD at work with (replace the socket path on Rocky/Alma/RHEL):

while true; do clear; echo STATS | socat - /var/run/rrdcached.sock; sleep 1; done
AuthorAndrisoft Team
Date Created26 December 2012
Date Updated16 August 2026
Views30,489