[rrd-developers] rrdcached BATCH not flushed
Anthony Molinaro
anthonym at alumni.caltech.edu
Fri Apr 13 07:09:59 CEST 2012
Well I 'solved' part of my problem, turns out the parsing I was doing
in perl was super slow. So swapping in a C program to parse the
file and piping to perl to write via RRDs::update via the daemon works
a lot better now. I'm hitting 150000 rrds in about 20 seconds or so
so I should be good for 2-3x my current number.
However, I'm still wondering why BATCH and flush didn't seem to work
together, so still curious about that.
Thanks,
-Anthony
On Thu, Apr 12, 2012 at 09:33:42AM -0700, Anthony Molinaro wrote:
> 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>
>
> _______________________________________________
> rrd-developers mailing list
> rrd-developers at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/rrd-developers
--
------------------------------------------------------------------------
Anthony Molinaro <anthonym at alumni.caltech.edu>
More information about the rrd-developers
mailing list