Apache Optimization in depth

Source: Internet
Author: User

* * 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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.