One writer, multiple readers

View: New views
2 Messages — Rating Filter:   Alert me  

One writer, multiple readers

by Jack Tavares :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello all
 
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?
Thanks
--
jack

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users

Re: One writer, multiple readers

by Alex van den Bogaerdt :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

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/

_______________________________________________
rrd-users mailing list
rrd-users@...
https://lists.oetiker.ch/cgi-bin/listinfo/rrd-users