[Orca-users] Threads

Hudes, Dana hudesd at hra.nyc.gov
Mon Aug 31 07:45:14 PDT 2009


 


>Blair Zajac [mailto:blair at orcaware.com] 
>I don't think we need threads for this.  The main loop in Orca is
single threaded, so when it goes to read from a data file, it'll use
>use the Compress::Bzip2 instance for that file.

>Plus, we probably don't want as many threads as there are hosts being
monitored, that would easily kill a box.

If the main loop is single-threaded
1) that would imply one bunzip2 process launched at a time and wait for
the result. That is not in fact the case.
If you look at the code it just keeps spawning bunzip2 processes until
the spawn fails.

2) Single-threaded main loop misses an easy obvious parallelism.

The optimal approach is not to launch a thread per host but to put work
into a queue which is read by a pool of worker threads. The number of
worker threads is configurable.  This is how, for example, Apache2
worker thread model works (of course most folks run apache2 in prefork
mode ).




More information about the Orca-users mailing list