Skip to content

Commit

Permalink
chore: benchmark test
Browse files Browse the repository at this point in the history
  • Loading branch information
vicanso committed Nov 14, 2024
1 parent 9d40a98 commit 0e519eb
Show file tree
Hide file tree
Showing 3 changed files with 138 additions and 0 deletions.
68 changes: 68 additions & 0 deletions Benchmark.md
Original file line number Diff line number Diff line change
@@ -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
```
25 changes: 25 additions & 0 deletions benches/bench.toml
Original file line number Diff line number Diff line change
@@ -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]
45 changes: 45 additions & 0 deletions benches/nginx.conf
Original file line number Diff line number Diff line change
@@ -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";
}
}
}

0 comments on commit 0e519eb

Please sign in to comment.