Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is Apache process model?

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?

like image 556
Morgan Cheng Avatar asked Mar 13 '10 13:03

Morgan Cheng


People also ask

What is Apache and how it works?

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.

What is Apache and its architecture?

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.

What is Apache child process?

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.

Why does PHP need Apache?

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.)


1 Answers

This depends on your system and configuration : see Core Features and Multi-Processing Modules : you could use, for instance :

  • Apache MPM winnt on windows -- that one uses threads
  • Or Apache MPM prefork -- that one uses processes
  • Or even Apache MPM worker -- which uses both several processes and threads.


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.

like image 174
Pascal MARTIN Avatar answered Nov 04 '22 07:11

Pascal MARTIN