[rrd-developers] New cached function: pause/resume
Steve Shipway
s.shipway at auckland.ac.nz
Thu Jan 20 04:14:57 CET 2011
I've developed a couple of new functions for the rrdcached - PAUSE and RESUME cause the write threads to be paused and resumed, allowing the RRD file to be quiesced temporarily for backup purposes. During the paused time, incoming updates simply go into the queue and so are not lost, though the memory footprint of the rrdcached will slowly go up.
To control this, I've had to add new commands to the rrdtool client. At Tobi's suggestion, this has been done by adding a new 'daemonctl' command, and absorbing the old 'flushcached' command into this.
Now we have:
rrdtool daemonctl [ flush [<file> ...]|pause|resume|stat ] [ --daemon <address> ]
So, the old 'rrdtool flushcached' has been replaced by 'rrdtool daemonctl flush'. Also, it can be called with NO file arguments, which results in a FLUSHALL command being sent to the daemon. To enable this, a new function rrdc_flushall has been added to the API.
The current version disables the flushcached command in the Windows build - since I don't know the reasoning behind this, I have also disabled the daemonctl command in the Windows build, but would like to hear from any Windows person who might know the reason for this. Maybe we can re-enable it?
The patch for this involves some new files ( rrddaemonctl.pod, rrd_pausecached.c, rrd_resumecached.c, rrd_cachedstat.c ), killing off an old file (rrdflushcached.pod) and modifications to rrd.h, rrd_tool.c, rrd_client.c, librrd.sym.in, Makefile.am.
Example:
[root at slayer src]# export RRDCACHED_ADDRESS=localhost
[root at slayer src]# ./rrdtool daemonctl flush
[root at slayer src]# ./rrdtool daemonctl flush foo.rrd
[root at slayer src]# ./rrdtool daemonctl flush foo.rrd --daemon localhost
[root at slayer src]# ./rrdtool daemonctl flush bar.rrd
ERROR: Flushing of file "bar.rrd" failed: rrdcached: No such file: /u01/rrdtool.test.1.4/bar.rrd.. Skipping remaining 0 files.
[root at slayer src]# ./rrdtool daemonctl pause
[root at slayer src]# ./rrdtool daemonctl flush foo.rrd
ERROR: Flushing of file "foo.rrd" failed: rrdcached: Write threads are paused. Use RESUME to restart.. Skipping remaining 0 files.
[root at slayer src]# ./rrdtool daemonctl flush
ERROR: rrdcached: Write threads are paused. Use RESUME to restart.
[root at slayer src]# ./rrdtool daemonctl resume
[root at slayer src]# ./rrdtool daemonctl resume foo
ERROR: Usage: rrdtool resume [--daemon <addr>]
[root at slayer src]# ./rrdtool daemonctl stats
QueueLength = 0
UpdatesReceived = 0
FlushesReceived = 3
UpdatesWritten = 0
DataSetsWritten = 0
TreeNodesNumber = 0
TreeDepth = 0
JournalBytes = 0
JournalRotate = 0
Paused = 0
[root at slayer src]# ./rrdtool daemonctl
RRDtool 1.4.99911011600 Copyright 1997-2009 by Tobias Oetiker <tobi at oetiker.ch>
Compiled Jan 20 2011 14:24:56
Usage: rrdtool [options] command command_options
* daemonctl - control rrdcached daemon
flush - flush cached data out to an RRD file
rrdtool daemonctl flush [filename.rrd] [--daemon <address>]
pause - pause the writing threads of cache daemon
rrdtool daemonctl pause [--daemon <address>]
resume - resume writing threads of cache daemon
rrdtool daemonctl resume [--daemon <address>]
stats - show statistics of cache daemon
rrdtool daemonctl stats [--daemon <address>]
RRDtool is distributed under the Terms of the GNU General
Public License Version 2. (www.gnu.org/copyleft/gpl.html)
For more information read the RRD manpages
[root at slayer src]#
Any thoughts/opinions from the community?
Steve
________________________________
Steve Shipway
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: s.shipway at auckland.ac.nz<mailto:s.shipway at auckland.ac.nz>
P Please consider the environment before printing this e-mail
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20110120/ec65377b/attachment-0001.htm
-------------- next part --------------
A non-text attachment was scrubbed...
Name: rrd-pause-diff
Type: application/octet-stream
Size: 32884 bytes
Desc: rrd-pause-diff
Url : http://lists.oetiker.ch/pipermail/rrd-developers/attachments/20110120/ec65377b/attachment-0001.obj
More information about the rrd-developers
mailing list