[rrd-users] One writer, multiple readers

Alex van den Bogaerdt alex at ergens.op.het.net
Wed Apr 23 12:38:08 CEST 2008


On Tue, Apr 22, 2008 at 07:51:57AM -0700, Jack Tavares wrote:

> In my setup I have one program writing to my rrd files
> using rrdtool executable.
>  
> I have, until now, only had one program reading my rrd files
> using rrdgraph.
>  
> We are, in the future going to also use CGI to run rrtdump
> on the rrd files.
>  
> It is likely that the 2 processes will try to read the same
> file at the same time (eventually)
>  
> Do I need to worry about multiple readers? Do I need
> to implement some sort of reader lock external to the
> rrd tool processes?

Locking won't be necessary, except for the locking already implemented
by RRDtool itself.

You will need to keep an eye on resource usage, especially if you
use lots of CDEFs.

RRDtool uses locking when it needs to write to the RRD. It does so
using fcntl F_WRLCK which, according to the manual page, can only
be done if no other process has the file open.  I can see a possible
problem when many processes want to read the RRD and processes are
waiting to get access. This said, with only a handful of readers
and no additional resource problems, I don't see how you can get
even near the danger zone.

Somebody with more experience and/or knowledge on locking: please
step in and verify/correct my findings.

HTH
-- 
Alex van den Bogaerdt
http://www.vandenbogaerdt.nl/rrdtool/



More information about the rrd-users mailing list