[collectd] Threads, pthreads, pth, ...

Peter Holik peter at holik.at
Fri Dec 16 13:05:57 CET 2005


> I wanted to do it in a different fassion, actually:
> - Upon startup, create one thread for each plugin
> - Each thread calls `it's' `init ()' function and then wait's on some
>   condition (pthread_cond_wait(3)).
> - Every 10 seconds the main loop wakes up all threads
>   (pthread_cond_broadcast(3)) and goes back to sleep.
>
> This means, one loop is done after:
>   main:      2ms
>   ping:    200ms
>   cpu:      10ms
>   hddtemp: 100ms

I like collectd, because of using less resources and threads
means additionsl context switches :-(

> So, if a host goes down, the network guy there was dumb enough to block
> all ICMP traffic and the ping plugin has to wait for a timeout, _it_
> (the ping module) will skip one turn while all other modules are updated
> in the meantime.
>
> Another step might be to ping all hosts in parallel, but
> a) this should be done using `select(2)' or `poll(2)' and

i prefere this

> b) doesn't help if more than one plugin is doing network stuff..

this means a mainloop (with `select(2)' or `poll(2)') is needed

like libevent

but what plugins does network stuff (except ping)?

cu Peter




More information about the Collectd mailing list