diff --git a/02.企业服务/04.Apache.md b/02.企业服务/04.Apache.md index 89b3165..3abb7cf 100644 --- a/02.企业服务/04.Apache.md +++ b/02.企业服务/04.Apache.md @@ -268,7 +268,7 @@ TIME-WAIT 0 0 [::ffff:127.0.0.1]:80 [::ffff:127.0.0.1]:33330 ``` -- 使用ab进行压力测试,在虚拟机环境中效果不明显 +- 使用ab进行压力测试,目前的apache默认的mpm模块是event支持上万并发,效果不明显 ```bash [root@localhost ~]# ab -c 1000 -n 10000 http://127.0.0.1/ @@ -391,7 +391,7 @@ This is NO.3 website! [root@localhost ~]# cat << EOF > /etc/httpd/conf.d/site.conf # vhost01 - ServerName website1.eagleslab.org + ServerName website1.iproute.cn Documentroot /data/website1/ Require all granted @@ -400,7 +400,7 @@ This is NO.3 website! # vhost02 - ServerName website2.eagleslab.org + ServerName website2.iproute.cn Documentroot /data/website2/ Require all granted @@ -409,7 +409,7 @@ This is NO.3 website! # vhost03 - ServerName website3.eagleslab.org + ServerName website3.iproute.cn Documentroot /data/website3/ Require all granted @@ -419,17 +419,17 @@ EOF # 本地添加解析 [root@localhost ~]# cat <> /etc/hosts -172.16.175.129 website1.eagleslab.org -172.16.175.129 website2.eagleslab.org -172.16.175.129 website3.eagleslab.org +172.16.175.129 website1.iproute.cn +172.16.175.129 website2.iproute.cn +172.16.175.129 website3.iproute.cn EOF # 重启服务并进行测试验证 -[root@localhost ~]# curl website1.eagleslab.org +[root@localhost ~]# curl website1.iproute.cn This is NO.1 website! -[root@localhost ~]# curl website2.eagleslab.org +[root@localhost ~]# curl website2.iproute.cn This is NO.2 website! -[root@localhost ~]# curl website3.eagleslab.org +[root@localhost ~]# curl website3.iproute.cn This is NO.3 website! ``` @@ -1469,6 +1469,12 @@ event MPM中,会有一个专门的线程来管理这些 keep-alive 类型的 event MPM在遇到某些不兼容的模块时,会失效,将会回退到worker模式,一个工作线程处理一个请求。官方自带的模块,全部是支持event MPM的。 +| 模式 | 特点 | KeepAlive处理 | 并发能力 | +| ----------- | --------------------------------------- | ---------------- | -------------- | +| **prefork** | 每个请求一个进程,无线程 | 同步阻塞,性能差 | 🟥 低(几百级) | +| **worker** | 每个进程多个线程 | 同步阻塞 | 🟧 中(几千级) | +| **event** | 每个进程多个线程,KeepAlive连接异步管理 | 非阻塞,线程复用 | 🟩 高(上万级) | + # 14. LAMP架构 LAMP就是由Linux+Apache+MySQL+PHP组合起来的架构