* * stress test [[email protected] ~]# which AB
/usr/bin/ab
ab-n2000-c800 www.benet.com/index.html
Send 2000 request, concurrent Connection 800
Can turn off the compression function, observe the pressure test results
**
Apache Working mode
Event Mode (default) view operating mode Cd/usr/local/httpd/bin
./httpd-l
Yum Install Lsof-y
**lsof-i: 80
COMMAND PID USER FD TYPE DEVICE size/off NODE NAME
httpd 2266 root 3u IPv4 15838 0t0 TCP 192.168.100.101:http (LISTEN)
httpd 2267 daemon 3u IPv4 15838 0t0 TCP 192.168.100.101:http (LISTEN)
httpd 2268 daemon 3u IPv4 15838 0t0 TCP 192.168.100.101:http (LISTEN)
httpd 2269 daemon 3u IPv4 15838 0t0 TCP 192.168.100.101:http (LISTEN)
A root master process with multiple daemon child processes * *
Prefork mode
./configure \
--PREFIX=/USR/LOCAL/HTTPD \
--enable-deflate \
--with-mpm=prefork \
--enable-expires \
--ENABLE-SO \
--enable-rewrite \
--enable-charset-lite \
--enable-cgi
**vim/etc/httpd.conf
Include conf/extra/httpd-mpm.conf
Vim/usr/local/httpd/conf/extra/httpd-mpm.conf
<ifmodule mpm_prefork_module>
Startservers 10 # Number of processes at startup
Minspareservers 10 # Minimum number of idle processes
Maxspareservers 50 # Maximum number of idle processes
Maxrequestworkers #最大并发进程数
Maxconnectionsperchild 0 # Maximum number of connections limit
</ifmodule>**
Worker mode
./configure \
--PREFIX=/USR/LOCAL/HTTPD \
--enable-deflate \
--with-mpm=worker \
--enable-expires \
--ENABLE-SO \
--enable-rewrite \
--enable-charset-lite \
--enable-cgi
**vim/etc/httpd.conf
Include conf/extra/httpd-mpm.conf
<ifmodule mpm_worker_module>
Startservers 2 #启动时进程数
Minsparethreads #最小空闲线程数
Maxsparethreads #最大空闲线程数
Threadsperchild #每个进程可以启动的线程数量
Maxrequestworkers #线程数量最大值
Maxconnectionsperchild 0 #最大连接数限制
Threadlimit #每个进程可以启动的线程数量上限值
</IfModule>
**
* * Directory Properties
Vim/etc/httpd.conf
<directory "/usr/local/httpd/htdocs" >
Options Indexes FollowSymLinks
AllowOverride None<RequireAll> Require all granted //允许所有 Require not ip 192.168.176.140 //不让176.140访问</RequireAll>
</directory>**
Apache Optimization in depth