apache tuning

http://my.oschina.net/renqingshigu/blog/678701
Comparison of prefork and worker mode The

prefork mode uses multiple child processes, and each child process has only one thread. Each process can only maintain one connection at a certain time. The Prefork MPM is more efficient than the Worker MPM on most platforms, but the memory usage is much larger. The threadless design of prefork will have advantages over workers in some cases: it can use third-party modules that do not handle thread safety well, and it is also easier to debug on platforms where thread debugging is difficult.

The worker mode uses multiple child processes, each with multiple threads. Each thread can only maintain one connection at a certain time. Generally speaking, on a high-traffic HTTP server, Worker MPM is a better choice because Worker MPM has much lower memory usage than Prefork MPM. But worker MPM is also imperfect, if a thread crashes, the whole process will "die" together with all its threads. Since threads share memory space, a program must be recognized by the system as "each thread" at runtime It's all safe."



./configure --with-mpm=worker (prefork)

httpd -v

apachectl -l show the current working mode

#default configuration of the mpm_perfork module



<IfModule mpm_prefork_module>

StartServers 5 #Recommended setting: small=default medium=20~50 large=50 ~100

MinSpareServers 5 #Recommended setting: consistent with StartServers

MaxSpareServers 10 #Recommended setting: Small=20 Medium=30~80 Large=80~120

MaxClients 150 #Recommended setting: Small=500 Medium=500~1500 Large=1500~3000

MaxRequestsPerChild 0 #Recommended setting: Small=10000 Medium or Large =10000~500000

(You also need to pay extra attention to the ServerLimit parameter, which is generally greater than the value of MaxClients.)

</IfModule>



StartServers, the number of child processes created when Apache is started.

MinSpareServers, the minimum number of child processes in idle state.

MaxSpareServers, the maximum number of child processes in idle state.

MaxClients, the maximum number of requests allowed for simultaneous connections.

The MaxRequestsPerChild command sets the number of requests that an independent child process will be able to handle.

ServerLimit is the maximum number of processes, and MaxClients is the maximum concurrent request, so their relationship is MaxClients=ServerLimit*The number of threads in the process

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326919529&siteId=291194637