RRDtool Cache Daemon
In big installations sooner or later one will recognize that processing the performance data will result in a relatively high I/O load. RRDtool has to do very much disk updates but cannot use the disk cache in an optimal way.
One improvement is made by collecting and sorting the data. It is more effective to write many updates to an RRD database in one block. The disk cache can be used more effectively that way.
The current RRDtool ( SVN trunk 1550+ ) contains rrdcached which should improve exactly this situation.
At this point I'd like to thank Florian octo Forster, Kevin Brintnall and Tobi Oetiker. The development of this daemon has been coordinated exemplary on the rrd-developers mailing list.
Mode of operation
The rrdcached is working as a daemon in the background and opens a UNIX or TCP socket to wait for requests of rrdtool.
rrdcached recognizes some important options which are passed during startup.
Option -l defines the socket the daemon will listen for update requests. The default TCP port will be 42217.
-l unix:/path/to/rrdcached.sock -l 127.0.0.1 -l 127.0.0.1:8888
Option -L is an unprivileged socket which only triggers the FLUSH command to write to the RRD databases using the daemon.
Option -w specifies the interval (in seconds) the data will be written to disk.
Option -z defines a maximum delay which will be used to spread the write cycles over a certain range [0-delay] to avoid parallel write accesses. The value of option -z must not be larger than -w.
Option -p defines a PID file
Option -j defines the path to a journaling directory. All requests will be logged there so that they can be processed after a restart in case the daemon crashes.
These options may result in a call of rrdcached with the following parameters
rrdcached -w 1800 -z 1800 -p /tmp/rrdcached.pid -j /tmp -l 127.0.0.1
RRDtool itself will be informed about the daemon using the option –daemon=<socket>.
rrdtool --daemon=127.0.0.1 update ...
Of course this has to correspond with the options of rrdcached!
Integration into PNP
Because two components of PNP have to prepared for the use of rrdcached there are changes in two config files.
1. Adjustment of process_perfdata.cfg for the data collector process_perfdata.pl
# EXPERIMENTAL rrdcached Support # Use only with rrdtool svn revision 1511+ # RRD_DAEMON_OPTS = 127.0.0.1:8888
2. Adjustment of config_local.php for the web interface
# # EXPERIMENTAL rrdcached Support # Use only with rrdtool svn revision 1511+ # # $conf['RRD_DAEMON_OPTS'] = 'unix:/tmp/rrdcached.sock'; $conf['RRD_DAEMON_OPTS'] = '127.0.0.1:8888';
Starting with PNP-0.4.11 the sample files contain the relevant options.