Re: [rrd-users] rrdtool, python and threads

This is a discussion on Re: [rrd-users] rrdtool, python and threads within the RRD Users forums, part of the Networking and Network Related category; > > Hello! > > > > > > > > I'm completely new to rrdtool AND mailing lists, ...


Go Back   Usenet Forums > Networking and Network Related > RRD Users

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 1 Week Ago
Yiannis Vavouranakis
 
Posts: n/a
Default Re: [rrd-users] rrdtool, python and threads

> > Hello!
> >
> >
> >
> > I'm completely new to rrdtool AND mailing lists, so please bear with me.
> >
> >
> >
> > Since I don't know whether this has been answered before, and I don't

know
> > how (or if) I can search the mailing list archives, I'm posting a

question.
> >
> >
> >
> > Here's my situation:
> >
> >
> >
> > I have a series of resources I'm monitoring (nothing to do with traffic
> > etc). I've already figured out what DS and RRA I need. I'm planning on
> > updating the relative RRDatabases (1 file per resource) via a python

script.
> > So far, I've created a bash script that calls the same python script

over
> > and over again with different command line arguments each time, so that

I
> > collect data from each resource, i.e. my bash script is like this:
> >
> >
> >
> > #!/bin/bash
> >
> > python get_the_resource.py resource1
> >
> > python get_the_resource.py resource2
> >
> > python get_the_resource.py resource3
> >
> > python get_the_resource.py resource4
> >
> > .
> >
> >
> >
> > The python script itself is quite I/O intensive: The whole bash script

takes
> > about 15 seconds to run for 6 resources monitored. I've also tried one
> > single resource (i.e. running one of the above lines on its own) and saw
> > that it took consistently about 2 seconds, most of which was used up

merely
> > for fetching data from the web.
> >
> >
> >
> > So I'm guessing that if I make a threaded python script that sends each
> > request in its own thread, I'll have a more effective program.

> I'd just use the main thread to update the rrd. Use worker threads to
> fetch the data and pass it to your main thread via a queue. This way
> only one thread has the rrd opened.
>
> hth
> Paul

Hello.

Thanks for the answer Paul.

Well, actually, since each resource has its own rrd file, abd I have one
thread per resource, then only one thread will have the rrd file open for
writing, and maybe another one will be reading from it to create a graph, so
I don't see the need for a queue here. Unless the python wrapper is entirely
thread unsafe...

Regards,
Yiannis Vavouranakis

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


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:17 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0