I'm a bit confused... @mbethke, are you telling me that I should try with MPM prefork?
I've been scraping the apache documentation for days and I found about MPM prefork:
It is appropriate for sites that need to avoid threading for compatibility with non-thread-safe libraries
So I thought this could not be the best approach. Otherwise I didn't understand how can I make a multi-threaded perl script working under Apache... Any help is welcome even if this could not be the correct place to post this request...
Thank you very much.
| [reply] |
lelotto85, the way I read this MPM-prefork doc snippet is that prefork is the appropriate multiprocessing mode if you want to run an Apache module that is itself not thread safe, stuff like *cough*mod_php*cough*. These modules fail if they are entered by multiple threads at the same time, e.g. because they use module-global variables, so Apache plays it safe with MPM-prefork and simply forks a new process for each connection handler. That doesn't mean that modules that are in fact able to use threads can't use them in the context of this process, think (as I said that's speculation because I haven't tried) it's rather the opposite: if Apache doesn't manage its own threading, you're least likely to screw it up when you create your own threads. May be worth trying.
That said, are you sure you need threads in your CGI? Depending on what other content or even other sites your Apache serves MPM-prefork can perform worse than other modules, especially on slow forkers like Solaris or Windows. Frameworks like Coro or POE could save you some headaches (although the latter may bring its own performance problems by being rather fat) by using cooperative multitasking that lets you have virtual threads without real multiprocessing. A sensibly loaded web server will make use of multiple CPUs anyway by using them to handle distinct connections.
| [reply] |
| [reply] |
| [reply] [d/l] [select] |