[mrtg] MRTG with RRDcached tuning
s.shipway at auckland.ac.nz
Wed Aug 1 23:58:55 CEST 2012
Here's some more info on the RRDcached options. Also see
Say you use these options:
-t 4 -w 1800 -z 60 -f 3600
This means that updates for an RRD will be written to the disk every
1800+rand(60) seconds, IE every 30 minutes plus up to 1 minute.
The reason for the -z option is to help spread the IO out over a period,
preventing it from hitting hard all at the same time. This helps prevent
buffer-overrun where Linux freezes as it flushes the IO buffer.
The -f options specifies an additional flush frequency for 'orphaned' RRD
files. The flush is normally only checked when the RRD is updated, so if
you stop updating, then pending updates may end up stuck in the cache. This
makes rrdcached scan every hour for orphaned updates, and flush them to
disk. You should have the -f option larger (maybe twice the size) than the
You can make the -z option larger if -w is larger. So, in our case with a
30min cache timeout, we could increase -z up to maybe 15min (-z 900) if the
disk IO is getting too high at times and low at others.
The more risk you want to take, the larger you can make -w (this increases
caching time and therefore decreases disk IO).
The setenv RRDCACHED_ADDRESS option for Apache works for us (haven't tried
with 14all but other non-rrdcached-aware CGI scripts are OK), though you
need to set it to the correct value and have it in the correct place. I
hope you didn't just copy my example - your cgi-bin is almost certainly in a
different location and your socket in a different path! Also make sure that
the apache user can read and write to the rrdcached socket! Finally, make
sure that you have the 1.4 version of the RRDs perl libraries as well as the
1.4 version of the rrdtool executable (sometimes people have multiple
versions of rrdtool perl libraries installed indifferent locations). Mike's
modification to 14all sets the environment var in the code, basically doing
what the SetEnv directive in the httpd.conf should be doing.
ITS Unix Services Design Lead
University of Auckland, New Zealand
Floor 1, 58 Symonds Street, Auckland
Phone: +64 (0)9 3737599 ext 86487
DDI: +64 (0)9 924 6487
Mobile: +64 (0)21 753 189
Email: <mailto:s.shipway at auckland.ac.nz> s.shipway at auckland.ac.nz
P Please consider the environment before printing this e-mail
From: Pavel Ruzicka [mailto:pavouk at pavouk.org]
Sent: Wednesday, 1 August 2012 9:19 p.m.
To: Steve Shipway
Cc: mrtg at lists.oetiker.ch
Subject: Re: [mrtg] MRTG with RRDcached tuning
> -s mrtg -m 0660 -l unix:/var/tmp/rrdcached.sock -l mrtg.auckland.ac.nz
> -l localhost -z 60
> -p /var/tmp/rrdcached.pid -t 4 -j /u01/rrdtool/journal -b /u01/rrdtool
> -w 1800 -O -a 6
I tried -w 1800 and -z 60, but it still doesn't solve massive pdflush.
I don't understand exactly -z option. I understand from documentation
that when I set -z to 60 seconds, that it set random write delay between 0
and 60 seconds. When I have -w for 1800, that rrdcached writes files to disk
in 60 seconds and -w option is not used. Is it true?
> This has had a significant improvement on our previous IO problems.
> For the frontend, you could use Routers2 (which supports rrdcached
I can't change easily frontend for historical reasons :-)
> :). However, if you prefer to use 14all, then you can still do this via
> rrrdcached, at least if you are using Apache. Just set the
> RRDCACHED_ADDRESS environment variable appropriately in the web server so
> that it is set when the CGI is called, and this will make the 14all calls
> all use rrdcached, where possible.
> <Directory "/u01/www/cgi-bin">
> SetEnv RRDCACHED_ADDRESS unix:/var/tmp/rrdcached.sock
I tried it, but it probably doesn't use rrdcached. How can I check it?
I have on graphs white space on the side. It looks like 14all.cgi use not
updated rrd file.
> You might want to consider using the trunk version of rrdtool, since this
> has more comprehensive rrdcached support for the various rrdtool
I prefer to use stable version, if it works.
Thank you very much for answers.
-------------- next part --------------
An HTML attachment was scrubbed...
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 6080 bytes
Desc: not available
Url : http://lists.oetiker.ch/pipermail/mrtg/attachments/20120801/7cb19fde/attachment-0001.bin
More information about the mrtg