[rrd-developers] rrdcached BATCH not flushed
Anthony Molinaro
anthonym at alumni.caltech.edu
Thu Apr 12 18:33:42 CEST 2012
Hi,
I have a large rrd setup which currently seems to only be able to handle
about 150000 rrds. My setup involves capturing some UDP packets with
information about metrics and each minute writing those to rrds via
rrdcached.
Basically the code looks like
while (!done) {
read packet from file
foreach metric in packet {
RRDs::update ($file, "$timestamp:$metric_value",
"--daemon", "/var/run/rrdcached.sock");
}
}
rrdcached is run as
rrdcached -l /var/run/rrdcached.sock -w 3600 -f 7200 \
-p /var/run/rrdcached.pid
I have a file each minute and attempt to load the previous minutes file.
At about 150000 rrds it starts taking more than a minute.
I thought I might be able to speed it up by connecting directly to the
daemon socket and using the BATCH command.
So I changed my code to buffer up a set of updates, do something like
my $name="/var/run/rrdcached.sock";
my $client = IO::Socket::UNIX->new(Peer => $name,
Type => SOCK_STREAM) or die "socket: $!";
print $client "BATCH\n";
$client->flush;
foreach my $update (@updates) {
print $client $update;
}
$client->flush;
print $client ".\n";
$client->flush;
print $client "QUIT\n";
$client->flush;
$client->close;
Which seems marginally faster (shaved about 10 seconds), however the real
issue is that flushes at the graphing layer don't seem to work when I use
this approach. With the prior approach viewing graphs seemed to cause
flushes in that the data was always up to date. With the latter approach
they do not get flushed until you send a FLUSHALL or I guess the flush timer
expires.
Has anyone else experienced this? Does anyone have any recommendations
for alternate approaches? If I were to have multiple clients calling
RRDs::update from say different threads would that help?
I'm using rrdtool 1.4.5 on Centos 5.4.
Thanks,
-Anthony
--
------------------------------------------------------------------------
Anthony Molinaro <anthonym at alumni.caltech.edu>
More information about the rrd-developers
mailing list