I have been googling this question for some time but got no answers. What's the Apache process model?
By process model, I mean how Apache manage process or thread to handling HTTP request.
Does it fork one process for each HTTP request?
Does it have process/thread pool?
Can we config it?
Is there any online doc for such Apache details?
As a Web server, Apache is responsible for accepting directory (HTTP) requests from Internet users and sending them their desired information in the form of files and Web pages. Much of the Web's software and code is designed to work along with Apache's features.
Apache is free and open-source software of web server that is used by approx 40% of websites all over the world. Apache HTTP Server is its official name. It is developed and maintained by the Apache Software Foundation. Apache permits the owners of the websites for serving content over the web.
A single control process (the parent) is responsible for launching child processes. Each child process creates a fixed number of server threads as specified in the ThreadsPerChild directive, as well as a listener thread which listens for connections and passes them to a server thread for processing when they arrive.
PHP isn't a web server, it's a scripting language. Since you do need a web server, as you say, Apache is rather necessary, yes. (Caveat, asterisk: PHP ships with a development web server, and you can write a web server in PHP, but both are bad ideas in production.)
This depends on your system and configuration : see Core Features and Multi-Processing Modules : you could use, for instance :
Quoting the page of the last one, Apache MPM worker :
This Multi-Processing Module (MPM) implements a hybrid multi-process multi-threaded server.
By using threads to serve requests, it is able to serve a large number of requests with fewer system resources than a process-based server.
However, it retains much of the stability of a process-based server by keeping multiple processes available, each with many threads.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With