11-13-周四_17-07-57

This commit is contained in:
AaronXu
2025-11-13 17:07:57 +08:00
parent 20675c5222
commit 47a8d9218d

View File

@@ -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
<Virtualhost 172.16.175.129>
ServerName website1.eagleslab.org
ServerName website1.iproute.cn
Documentroot /data/website1/
<Directory /data/website1>
Require all granted
@@ -400,7 +400,7 @@ This is NO.3 website!
# vhost02
<Virtualhost 172.16.175.129>
ServerName website2.eagleslab.org
ServerName website2.iproute.cn
Documentroot /data/website2/
<Directory /data/website2>
Require all granted
@@ -409,7 +409,7 @@ This is NO.3 website!
# vhost03
<Virtualhost 172.16.175.129>
ServerName website3.eagleslab.org
ServerName website3.iproute.cn
Documentroot /data/website3/
<Directory /data/website3>
Require all granted
@@ -419,17 +419,17 @@ EOF
# 本地添加解析
[root@localhost ~]# cat <<EOF >> /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组合起来的架构