diff --git a/Benchmark.md b/Benchmark.md new file mode 100644 index 0000000..6fadee1 --- /dev/null +++ b/Benchmark.md @@ -0,0 +1,68 @@ +# Benchmark + +## Nginx + +```bash +wrk 'http://127.0.0.1:6200/ping' --latency + +Running 10s test @ http://127.0.0.1:6200/ping + 2 threads and 10 connections + Thread Stats Avg Stdev Max +/- Stdev + Latency 140.44us 705.01us 16.07ms 98.80% + Req/Sec 65.13k 2.92k 72.33k 85.15% + Latency Distribution + 50% 73.00us + 75% 80.00us + 90% 86.00us + 99% 1.97ms + 1309147 requests in 10.10s, 187.27MB read +Requests/sec: 129597.70 +Transfer/sec: 18.54MB +``` + +## Pingap + +```bash +wrk 'http://127.0.0.1:6100/ping' --latency + +Running 10s test @ http://127.0.0.1:6100/ping + 2 threads and 10 connections + Thread Stats Avg Stdev Max +/- Stdev + Latency 83.14us 25.54us 1.18ms 82.07% + Req/Sec 59.22k 1.13k 62.14k 94.06% + Latency Distribution + 50% 89.00us + 75% 96.00us + 90% 103.00us + 99% 122.00us + 1190455 requests in 10.10s, 155.54MB read +Requests/sec: 117876.05 +Transfer/sec: 15.40MB +``` + +## Nginx --> Nginx + +```bash +wrk 'http://127.0.0.1:6200/ping' --latency + +Running 10s test @ http://127.0.0.1:6200/ping + 2 threads and 10 connections + Thread Stats Avg Stdev Max +/- Stdev + Latency 287.76us 2.00ms 43.08ms 98.30% + Req/Sec 64.58k 4.49k 79.88k 87.13% + Latency Distribution + 50% 73.00us + 75% 81.00us + 90% 88.00us + 99% 8.16ms + 1298148 requests in 10.10s, 185.70MB read +Requests/sec: 128518.38 +Transfer/sec: 18.38MB +``` + + +## Pingap --> Nginx + +```bash +wrk 'http://127.0.0.1:6101/ping' --latency +``` diff --git a/benches/bench.toml b/benches/bench.toml new file mode 100644 index 0000000..eafca84 --- /dev/null +++ b/benches/bench.toml @@ -0,0 +1,25 @@ +[basic] + +[upstreams.backend] +addrs = ["127.0.0.1:6200"] + +[locations.bench] +plugins = ["pingap:ping"] + +[locations.pingap-nginx] +upstream = "backend" + +[servers.bench] +addr = "127.0.0.1:6100" +locations = ["bench"] +threads = 1 + +[servers.pingap-nginx] +addr = "127.0.0.1:6101" +locations = ["pingap-nginx"] + +[plugins] + +[certificates] + +[storages] diff --git a/benches/nginx.conf b/benches/nginx.conf new file mode 100644 index 0000000..150b3ac --- /dev/null +++ b/benches/nginx.conf @@ -0,0 +1,45 @@ +worker_processes 1; + +events { + use kqueue; + worker_connections 1024; +} + + +http { + include mime.types; + default_type application/octet-stream; + + upstream backend { + server 127.0.0.1:6200; + keepalive 300; + } + + + sendfile on; + keepalive_timeout 65; + keepalive_requests 1000000; + server { + listen 6201; + #server_name localhost; + #access_log /tmp/access.log access; + location / { + default_type text/json; + proxy_pass http://backend; + } + + error_page 500 502 503 504 /50x.html; + location = /50x.html { + root html; + } + } + server { + listen 6200; + server_name localhost:6200; + #access_log /tmp/access.log access; + location / { + default_type text/json; + return 200 "pong"; + } + } +}