in reply to Re^2: Share symbol table between threads
in thread Share symbol table between threads
If you're concerned about performance, the general advice is to have a persistent thread pool, with the number of threads proportional to the number of execution cores on your system.
There appears to be a CPAN module, Thread::Pool which automates this process. If you did this, then you'll just require the modules in-thread and they'll only be loaded once per thread. Looking at the docs, you'll want max == min so that threads don't die off.
There are performance tradeoffs here. Using a pool should reduce mean latency (since you don't have to start a new perl thread before handling the request) but may introduce unpredictably to the latency, since the pool may be at max when a new request comes in. An appropriately-sized pool should increase the throughput (ops/second) since less work is being done per op (you aren't starting a whole new thread).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Share symbol table between threads
by jwu (Novice) on Oct 04, 2006 at 13:22 UTC |