一個(gè)小型的商城單實(shí)例在跑,用戶數(shù)量上來以后發(fā)現(xiàn)加載緩慢婚夫,檢查阿里云發(fā)現(xiàn)80%的connection都not_established, 優(yōu)化一下Apache配置試試激才。
先查看Apache的MPM工作模式
$ apachectl -V
Server version: Apache/2.4.6 (CentOS)
Server built: Oct 19 2017 20:39:16
Server's Module Magic Number: 20120211:24
Server loaded: APR 1.4.8, APR-UTIL 1.5.2
Compiled using: APR 1.4.8, APR-UTIL 1.5.2
Architecture: 64-bit
Server MPM: prefork
threaded: no
forked: yes (variable process count)
先改一個(gè)1000試試
<IfModule mpm_prefork_module>
StartServers 10
MinSpareServers 10
MaxSpareServers 50
ServerLimit 1000
MaxRequestWorkers 1000
MaxConnectionsPerChild 0
</IfModule>