On May 28, 2012 16:10 , Xin Tong <xerox.time.tech@xxxxxxxxx> wrote:
I noticed that apache httpd spawns many processes to server user request. one of the httpd process is the master (i.e. running with root id on linux). the other ones are it children ( i.e. running with daemon id). is the master httpd process kind of like a load dispatcher and the ones running with daemon like the workers ? Is there a way to build apache such that it does not spawn new processes. instead it spawns new threads within the root process to handle incoming request ?
Run "httpd -V" and look at the line "Server MPM". What you describe above sounds most like the prefork MPM ( https://httpd.apache.org/docs/2.4/mod/prefork.html ) but what you want is probably the event MPM ( https://httpd.apache.org/docs/2.4/mod/event.html ) if you are running httpd 2.4, or the worker MPM ( https://httpd.apache.org/docs/2.4/mod/worker.html ) if you are running httpd 2.2.
If you are running Apache HTTP Server 2.4, and it was built with the option "--enable-mpms-shared=all" then you do not need to rebuild httpd in order to switch to a different MPM. If you are running 2.4 without this option, or if you are running 2.2, then you might need to rebuild httpd -- but some Linux distributions (such as Red Hat, CentOS, Fedora) will provide multiple versions of httpd, each with a different MPM, and you can either switch to the right version ( like /usr/sbin/httpd.worker ) or install it as a separate package.
Note that even if you use the event or worker MPM, there will be multiple httpd processes. But each process will use threads to handle requests. This is better than the prefork MPM where each processes handles only one request at a time. For performance and scalability reasons, it would be bad to have only one process that handles everything via threads. In the special case where you are trying to debug httpd, you can start it with the -X option to limit it to a single worker in a single process.
-- Mark Montague mark@xxxxxxxxxxx --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@xxxxxxxxxxxxxxxx For additional commands, e-mail: users-help@xxxxxxxxxxxxxxxx