Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
benchmark apisix 0.5 with fake apisix server
# ./benchmark/run.sh
+ '[' -n '' ']'
+ worker_cnt=1
+ mkdir -p benchmark/server/logs
+ mkdir -p benchmark/fake-apisix/logs
+ sudo openresty -p /root/apisix/benchmark/server
+ trap onCtrlC INT
+ sed -i 's/worker_processes [0-9]*/worker_processes 1/g' conf/nginx.conf
+ make run
mkdir -p logs
mkdir -p /tmp/cores/
$(which openresty) -p $PWD/
+ sleep 3
+ echo -e '\n\napisix: 1 worker + 1 upstream + no plugin'
apisix: 1 worker + 1 upstream + no plugin
+ curl http://127.0.0.1:9080/apisix/admin/routes/1 -X PUT -d '
{
"uri": "/hello",
"plugins": {
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:80": 1
}
}
}'
{"node":{"value":{"plugins":{},"uri":"\/hello","upstream":{"nodes":{"127.0.0.1:80":1},"type":"roundrobin"}},"createdIndex":62,"key":"\/apisix\/routes\/1","modifiedIndex":62},"prevNode":{"value":"{\"plugins\":{\"limit-count\":{\"time_window\":60,\"rejected_code\":503,\"count\":2000000000000,\"key\":\"remote_addr\"},\"prometheus\":{}},\"uri\":\"\\\/hello\",\"upstream\":{\"nodes\":{\"127.0.0.1:80\":1},\"type\":\"roundrobin\"}}","createdIndex":60,"key":"\/apisix\/routes\/1","modifiedIndex":60},"action":"set"}
+ sleep 1
+ wrk -d 5 -c 16 http://127.0.0.1:9080/hello
Running 5s test @ http://127.0.0.1:9080/hello
2 threads and 16 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 682.64us 106.53us 5.13ms 90.98%
Req/Sec 11.75k 753.64 12.52k 83.33%
119278 requests in 5.10s, 406.32MB read
Requests/sec: 23389.33
Transfer/sec: 79.68MB
+ sleep 1
+ wrk -d 5 -c 16 http://127.0.0.1:9080/hello
Running 5s test @ http://127.0.0.1:9080/hello
2 threads and 16 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 696.03us 118.73us 3.43ms 89.72%
Req/Sec 11.53k 1.59k 24.83k 99.01%
115772 requests in 5.10s, 394.37MB read
Requests/sec: 22700.62
Transfer/sec: 77.33MB
+ sleep 1
+ echo -e '\n\napisix: 1 worker + 1 upstream + 2 plugins (limit-count + prometheus)'
apisix: 1 worker + 1 upstream + 2 plugins (limit-count + prometheus)
+ curl http://127.0.0.1:9080/apisix/admin/routes/1 -X PUT -d '
{
"uri": "/hello",
"plugins": {
"limit-count": {
"count": 2000000000000,
"time_window": 60,
"rejected_code": 503,
"key": "remote_addr"
},
"prometheus": {}
},
"upstream": {
"type": "roundrobin",
"nodes": {
"127.0.0.1:80": 1
}
}
}'
{"node":{"value":{"plugins":{"limit-count":{"time_window":60,"rejected_code":503,"count":2000000000000,"key":"remote_addr"},"prometheus":{}},"uri":"\/hello","upstream":{"nodes":{"127.0.0.1:80":1},"type":"roundrobin"}},"createdIndex":63,"key":"\/apisix\/routes\/1","modifiedIndex":63},"prevNode":{"value":"{\"plugins\":{},\"uri\":\"\\\/hello\",\"upstream\":{\"nodes\":{\"127.0.0.1:80\":1},\"type\":\"roundrobin\"}}","createdIndex":62,"key":"\/apisix\/routes\/1","modifiedIndex":62},"action":"set"}
+ sleep 3
+ wrk -d 5 -c 16 http://127.0.0.1:9080/hello
Running 5s test @ http://127.0.0.1:9080/hello
2 threads and 16 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 812.11us 171.62us 9.68ms 94.27%
Req/Sec 9.91k 704.58 10.65k 73.00%
98617 requests in 5.00s, 342.71MB read
Requests/sec: 19718.77
Transfer/sec: 68.53MB
+ sleep 1
+ wrk -d 5 -c 16 http://127.0.0.1:9080/hello
Running 5s test @ http://127.0.0.1:9080/hello
2 threads and 16 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 823.08us 131.22us 3.60ms 91.77%
Req/Sec 9.75k 708.98 10.57k 65.69%
98965 requests in 5.10s, 343.92MB read
Requests/sec: 19405.12
Transfer/sec: 67.44MB
+ sleep 1
+ make stop
$(which openresty) -p $PWD/ -s stop
+ echo -e '\n\nfake empty apisix server: 1 worker'
fake empty apisix server: 1 worker
+ sleep 1
+ sed -i 's/worker_processes [0-9]*/worker_processes 1/g' benchmark/fake-apisix/conf/nginx.conf
+ sudo openresty -p /root/apisix/benchmark/fake-apisix
+ sleep 1
+ wrk -d 5 -c 16 http://127.0.0.1:9080/hello
Running 5s test @ http://127.0.0.1:9080/hello
2 threads and 16 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 567.03us 82.48us 3.38ms 92.07%
Req/Sec 14.14k 1.51k 28.84k 97.03%
142045 requests in 5.10s, 483.87MB read
Requests/sec: 27857.10
Transfer/sec: 94.89MB
+ sleep 1
+ wrk -d 5 -c 16 http://127.0.0.1:9080/hello
Running 5s test @ http://127.0.0.1:9080/hello
2 threads and 16 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 585.89us 78.36us 3.43ms 89.24%
Req/Sec 13.68k 0.86k 14.53k 78.43%
138813 requests in 5.10s, 472.86MB read
Requests/sec: 27217.91
Transfer/sec: 92.72MB
+ sudo openresty -p /root/apisix/benchmark/fake-apisix -s stop
+ sudo openresty -p /root/apisix/benchmark/server -s stop
@membphis

This comment has been minimized.

Copy link
Owner Author

@membphis membphis commented Jul 3, 2019

结果都是每秒的 QPS:

case apisix 1 worker empty 1 worker percent
1 upstream + 0 plugin 23819.32 28071.08 84.8%
1 upstream + 0 plugin 23928.15 28072.27 85.2%
1 upstream + 2 plugin 19519.52
1 upstream + 2 plugin 19833.96
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment