PERL MultiThread Library

NOTE: The latest versions of this are now on CPAN! The versions on this page are outdated and here for historical purposes only.

This library builds on the PERL 5.8 interpreter threads to implement Worker Pool and Pipeline concurrency models. There is some documentation in perldoc included in MultiThread.pm, along with example programs for each model.

License

This software may be used under the terms of the PERL Artistic License.

Maturity

This library behaves well under testing. However, it is very new, so please test your applications thoroughly. The API should be relatively stable at this point, and no crashes or lock-ups have been observed. Performance seems very good, having sustained over 10,500 requests per second on my development laptop. While new features may be added later, the library can be considered essentially feature-complete. Further development will focus on bug fixes and programmer convenience.

Platform Support

This library is developed under Linux, and as of 0.5, has no Linux-specific logic in it. I use it under Windows with Active State PERL 5.6 and 5.8 and under Linux, so you can be pretty confident it will work under your OS.

Pool Size Note

The default behavior of the WorkerPool model is to use the number of CPUs as a default worker pool size. I've found that, depending on the work loads, a worker pool size of 50-70 can be optimal -- especially in cases where the hold-up is not the CPU but network latency or other environmental slowdowns. The point is, the defaults are nice and probably sensible, but don't be afraid to crank it way up and see whether it affects performance positively or negatively.

A general rule is that many threads processing small workloads will work faster than fewer threads processing large work loads. Obviously, that depends very heavily on what kind of work you're doing, but it's something to think about when designing your app.

Feedback

Please feel free to leave your experiences with the software in the comments section below, or use the site's Contact page to contact me directly.