版本信息:
------
nginx version: nginx/1.13.6
lua-nginx-module-0.10.11
LuaJIT 2.1.0-beta3
------
配置信息,其中perf_proxy是同一网段另一台机器,发包机器是同一网段的第三台机器,本机开启一个worker进程。
----------
server {
server_name www.perf.com;
listen [::]:80 http2 reuseport;
access_by_lua_block {
}
header_filter_by_lua_block {
}
body_filter_by_lua_block {
}
log_by_lua_block {
}
gzip on;
gunzip on;
location / {
proxy_pass http://perf_proxy;
}
}
---------
当没有加入*_by_lua_block这些指令的情况下,从发包机器测试
[root@f227 wrk-master]# ./wrk -t3 -c100 -d60s http://www.perf.com/index.html
Running 1m test @ http://www.perf.com/index.html
3 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 9.54ms 1.03ms 29.94ms 81.69%
Req/Sec 3.47k 249.98 3.98k 82.67%
621995 requests in 1.00m, 788.34MB read
Requests/sec: 10363.66
Transfer/sec: 13.14MB
当加入*_by_lua_block后,从发包机器测试
[root@227 wrk-master]# ./wrk -t3 -c100 -d60s http://www.perf.com/index.html
Running 1m test @ http://www.perf.com/index.html
3 threads and 100 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 12.33ms 1.51ms 56.12ms 89.70%
Req/Sec 2.69k 185.09 3.03k 90.17%
481782 requests in 1.00m, 610.63MB read
Requests/sec: 8026.02
Transfer/sec: 10.17MB
可以看出从每沙10300下降到8000,将近20的下降。这是正常的吗?还是我这边引入的姿势不对?
从火焰查找lua关键字,大概也占了20%。
貌似这里无法上传svg图,先截个图放上这里好了。