Detailed Apache three operating modes and directory attributes

Apache mode of presentation

1.Apache作为现今web服务器用的最广泛也是最稳定的开源服务器软件
2.其工作模式有许多种,源码包安装httpd时可查看httpd-mpm.conf文件,该文件位于extra/conf目录中
3.目前主要有两种模式:
event模式:一个进程中包含多个线程
prefork模式:一个进程中包含一个线程
worker模式:一个进程中包含多个线程

event mode of presentation

1.event是Apache最新的工作模式,它和worker模式很像,不同的是在于它解决了keep-alive长连接的时候占用线程资源被浪费的问题
2.event工作模式在遇到某些不兼容的模块时,会失效,将会回退到worker模式
3.event工作模式需要Linux系统(Linux 2.6+)对epoll的支持,才能启用。需要补充的是HTTPS的连接(SSL)
4.在event工作模式中,会有一些专门的线程用来管理这些keep-alive类型的线程
5.当有真实请求过来的时候,将请求传递给服务器的线程执行完毕后,又允许它释放
6.这样, 一个线程就能处理几个请求了 ,实现了 异步非阻塞。这增强了在高并发场景下的请求处理

event parameters to explain

Httpd-mpm.conf the configuration file, the following definitions are prefork module

<IfModule mpm_event_module>
  StartServers      3
  MinSpareThreads       75
  MaxSpareThreads       250
  ThreadsPerChild       25
  MaxRequestWorkers     400
  MaxConnectionsPerChild  0
</IfModule>

Parameter Description
Detailed Apache three operating modes and directory attributes

event Optimization Tips

1. The production environment can be debugged in order to determine the appropriate parameters
2. Optimization Reference

<IfModule mpm event module>
  ServerLimit       1000
  StartServers  20
  MinSpareThreads       25
  MaxSpareThreads       1200
  ThreadsPerChild       50
  MaxRequestWorkers     2000
  MaxC onnectionsPerChild 1000
</IfModule>

prefork mode of presentation

Detailed Apache three operating modes and directory attributes
prefork parameters explain
the httpd-mpm.conf configuration file, the following definitions are prefork module

<IfModule mpm_ prefork module>
  StartServers      20
  MinSpareServers       10
  MaxSpareServers       50
  MaxClients        150
  MaxRequestsPerChild   0
</IfModule>

Parameter Description:
Detailed Apache three operating modes and directory attributes

prefork Optimization Tips

1. The production environment can be debugged in order to determine the appropriate parameters
2. Optimization Reference

<IfModule mpm prefork module>
  ServerLimit           1000
  StartServers      10
  MinSpareServers       10
  MaxSpareServers       30
  MaxClients        1000
  MaxRequestsPerChild 5000
</IfModule>

worker works

Detailed Apache three operating modes and directory attributes
Detailed Apache three operating modes and directory attributes

Apache directory properties

Detailed Apache three operating modes and directory attributes
Directory attribute parameter:
Detailed Apache three operating modes and directory attributes
Detailed Apache three operating modes and directory attributes

Guess you like

Origin blog.51cto.com/14475593/2447946