nginx配置大概是limit_req_zone $binary_remote_addr zone=req_zone:1m rate=1r/s;
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/host.access.log main;
root /usr/share/nginx/html;
location / {
root /usr/share/nginx/html;
index index.html index.htm;
limit_req zone=req_zone;
}
}p.php是phpinfoab -n 20 -c 20 http://192.168.1.251/p.php 结果是Concurrency Level: 20Time taken for tests: 0.071 secondsComplete requests: 20Failed requests: 3 (Connect: 0, Receive: 0, Length: 3, Exceptions: 0)Write errors: 0Total transferred: 1645517 bytesHTML transferred: 1642257 bytesRequests per second: 282.81 [#/sec] (mean)Time per request: 70.719 [ms] (mean)Time per request: 3.536 [ms] (mean, across all concurrent requests)Transfer rate: 22723.03 [Kbytes/sec] received而压测静态文件结果是ab -n 20 -c 20 http://192.168.1.251/1.htmlConcurrency Level: 20Time taken for tests: 0.022 secondsComplete requests: 20Failed requests: 19 (Connect: 0, Receive: 0, Length: 19, Exceptions: 0)Write errors: 0Non-2xx responses: 19Total transferred: 8843 bytesHTML transferred: 4928 bytesRequests per second: 892.38 [#/sec] (mean)Time per request: 22.412 [ms] (mean)Time per request: 1.121 [ms] (mean, across all concurrent requests)Transfer rate: 385.32 [Kbytes/sec] received为什么差距那么大呢?
目前暂无任何回答
- 0 回答
- 1 关注
- 1344 浏览
添加回答
举报
0/150
提交
取消