Skip to content

Commit a90861b

Browse files
committed
results
1 parent 03ec7a8 commit a90861b

39 files changed

Lines changed: 7743 additions & 7864 deletions

.github/workflows/benchmark.yml

Lines changed: 28 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Benchmark
22

33
on:
4+
push:
5+
branches: [main]
6+
paths:
7+
- 'frameworks/**'
48
workflow_dispatch:
59
inputs:
610
framework:
@@ -11,44 +15,47 @@ on:
1115
permissions:
1216
contents: write
1317

18+
concurrency:
19+
group: benchmark
20+
cancel-in-progress: false
21+
1422
jobs:
1523
benchmark:
1624
runs-on: self-hosted
1725
steps:
1826
- uses: actions/checkout@v4
27+
with:
28+
fetch-depth: 2
1929

20-
- name: Determine frameworks
21-
id: frameworks
30+
- name: Detect modified frameworks
31+
id: detect
2232
run: |
2333
if [ -n "${{ inputs.framework }}" ]; then
2434
echo "list=${{ inputs.framework }}" >> "$GITHUB_OUTPUT"
2535
else
26-
echo "list=$(ls -d frameworks/*/ | xargs -n1 basename | tr '\n' ' ')" >> "$GITHUB_OUTPUT"
36+
list=$(git diff --name-only HEAD~1 HEAD \
37+
| grep '^frameworks/' \
38+
| cut -d'/' -f2 \
39+
| sort -u \
40+
| tr '\n' ' ')
41+
echo "list=$list" >> "$GITHUB_OUTPUT"
2742
fi
2843
2944
- name: Run benchmarks
45+
if: steps.detect.outputs.list != ''
3046
run: |
31-
for fw in ${{ steps.frameworks.outputs.list }}; do
47+
for fw in ${{ steps.detect.outputs.list }}; do
3248
echo ">>> Benchmarking: $fw"
33-
./scripts/benchmark.sh "$fw" || echo "WARN: $fw benchmark failed"
49+
./scripts/benchmark.sh --save "$fw" || echo "WARN: $fw benchmark failed"
3450
done
3551
36-
- name: Update site data
37-
run: |
38-
mkdir -p site/data
39-
echo '[' > site/data/results.json
40-
first=true
41-
for f in results/*.json; do
42-
[ -f "$f" ] || continue
43-
$first || echo ',' >> site/data/results.json
44-
cat "$f" >> site/data/results.json
45-
first=false
46-
done
47-
echo ']' >> site/data/results.json
48-
49-
- name: Commit results
52+
- name: Commit and push results
53+
if: steps.detect.outputs.list != ''
5054
run: |
5155
git config user.name "HttpArena Bot"
5256
git config user.email "bot@httparena"
53-
git add site/data/results.json
54-
git diff --cached --quiet || git commit -m "Update benchmark results" && git push
57+
git add results/ site/data/ site/static/logs/
58+
if ! git diff --cached --quiet; then
59+
git commit -m "benchmark: update results for ${{ steps.detect.outputs.list }}"
60+
git push
61+
fi

frameworks/nginx/nginx.conf

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ http {
4141
ssl_certificate /certs/server.crt;
4242
ssl_certificate_key /certs/server.key;
4343
ssl_protocols TLSv1.3;
44+
ssl_session_tickets on;
45+
ssl_session_cache shared:SSL:10m;
46+
47+
http2_max_concurrent_streams 256;
48+
http2_max_requests 10000000;
4449

4550
add_header Alt-Svc 'h3=":8443"; ma=86400';
4651

scripts/benchmark.sh

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ H2LOAD="${H2LOAD:-h2load}"
1010
OHA="${OHA:-$HOME/.cargo/bin/oha}"
1111
HARD_NOFILE=$(ulimit -Hn)
1212
ulimit -n "$HARD_NOFILE"
13-
THREADS="${THREADS:-12}"
13+
THREADS="${THREADS:-64}"
14+
H2THREADS="${H2THREADS:-128}"
1415
DURATION=5s
1516
RUNS=3
1617
PORT=8080
@@ -30,8 +31,8 @@ declare -A PROFILES=(
3031
[upload]="1|0||64,256,512|upload"
3132
[compression]="1|0||4096,16384|compression"
3233
[noisy]="1|0||512,4096,16384|noisy"
33-
[baseline-h2]="1|0||64,256,1024|h2"
34-
[static-h2]="1|0||64,256,1024|static-h2"
34+
[baseline-h2]="1|0||256,1024|h2"
35+
[static-h2]="1|0||256,1024|static-h2"
3536
[baseline-h3]="32|0||256,512|h3"
3637
[static-h3]="32|0||256,512|static-h3"
3738
)
@@ -208,11 +209,31 @@ cleanup() {
208209
docker stop -t 5 "$CONTAINER_NAME" 2>/dev/null || true
209210
docker rm -f "$CONTAINER_NAME" 2>/dev/null || true
210211
}
211-
trap cleanup EXIT
212+
213+
# Save original CPU governor
214+
ORIG_GOVERNOR=$(cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor 2>/dev/null || echo "")
215+
216+
restore_settings() {
217+
docker stop -t 5 "$CONTAINER_NAME" 2>/dev/null || true
218+
docker rm -f "$CONTAINER_NAME" 2>/dev/null || true
219+
if [ -n "$ORIG_GOVERNOR" ]; then
220+
echo "[restore] Restoring CPU governor to $ORIG_GOVERNOR..."
221+
for g in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
222+
sudo sh -c "echo $ORIG_GOVERNOR > $g" 2>/dev/null || true
223+
done
224+
fi
225+
}
226+
trap restore_settings EXIT
212227

213228
# Clean slate: stop containers, restart Docker, drop caches
214229
docker ps -q --filter "name=httparena-" | xargs -r docker stop -t 5 2>/dev/null || true
215230
docker ps -aq --filter "name=httparena-" | xargs -r docker rm -f 2>/dev/null || true
231+
232+
echo "[tune] Setting CPU governor to performance..."
233+
for g in /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor; do
234+
sudo sh -c "echo performance > $g" 2>/dev/null || true
235+
done
236+
216237
echo "[clean] Restarting Docker daemon..."
217238
sudo systemctl restart docker
218239
sleep 3
@@ -327,12 +348,12 @@ for profile in "${profiles_to_run[@]}"; do
327348
USE_H2LOAD=true
328349
gc_args=("$H2LOAD"
329350
-i "$REQUESTS_DIR/static-h2-uris.txt"
330-
-c "$CONNS" -m 100 -t "$THREADS" -D "$DURATION")
351+
-c "$CONNS" -m 100 -t "$H2THREADS" -D "$DURATION")
331352
elif [ "$endpoint" = "h2" ]; then
332353
USE_H2LOAD=true
333354
gc_args=("$H2LOAD"
334355
"https://localhost:$H2PORT/baseline2?a=1&b=1"
335-
-c "$CONNS" -m 100 -t "$THREADS" -D "$DURATION")
356+
-c "$CONNS" -m 100 -t "$H2THREADS" -D "$DURATION")
336357
elif [ "$endpoint" = "pipeline" ]; then
337358
gc_args=("http://localhost:$PORT/pipeline"
338359
-c "$CONNS" -t "$THREADS" -d "$DURATION" -p "$pipeline")

site/content/docs/running-locally/running-benchmarks.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,16 @@ With `--save`, it additionally:
5454
8. Rebuilds site data files in `site/data/`
5555

5656
For HTTP/1.1 profiles (`baseline`, `pipelined`, `limited-conn`, `json`, `upload`, `compression`, `noisy`), the load generator is **gcannon**. For HTTP/2 profiles (`baseline-h2`, `static-h2`), the load generator is **h2load**. For HTTP/3 profiles (`baseline-h3`, `static-h3`), the load generator is **oha**.
57+
58+
## Environment variables
59+
60+
| Variable | Default | Description |
61+
|----------|---------|-------------|
62+
| `THREADS` | `64` | Number of threads for **gcannon** (HTTP/1.1 load generator) |
63+
| `H2THREADS` | `128` | Number of threads for **h2load** (HTTP/2 load generator) |
64+
65+
Example — run with custom thread counts:
66+
67+
```bash
68+
THREADS=8 H2THREADS=128 ./scripts/benchmark.sh aspnet-minimal
69+
```

site/data/baseline-16384.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,18 @@
162162
{
163163
"framework": "h2o",
164164
"language": "C",
165-
"rps": 2903962,
166-
"avg_latency": "5.47ms",
167-
"p99_latency": "21.20ms",
168-
"cpu": "6345.3%",
165+
"rps": 2930585,
166+
"avg_latency": "5.42ms",
167+
"p99_latency": "22.50ms",
168+
"cpu": "6318.3%",
169169
"memory": "192.7MiB",
170170
"connections": 16384,
171171
"threads": 64,
172172
"duration": "5s",
173173
"pipeline": 1,
174-
"bandwidth": "285.42MB/s",
174+
"bandwidth": "287.63MB/s",
175175
"reconnects": 0,
176-
"status_2xx": 14548851,
176+
"status_2xx": 14652926,
177177
"status_3xx": 0,
178178
"status_4xx": 0,
179179
"status_5xx": 0

site/data/baseline-4096.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,18 @@
162162
{
163163
"framework": "h2o",
164164
"language": "C",
165-
"rps": 3163543,
166-
"avg_latency": "1.29ms",
167-
"p99_latency": "8.28ms",
168-
"cpu": "6851.9%",
169-
"memory": "77.6MiB",
165+
"rps": 3246907,
166+
"avg_latency": "1.26ms",
167+
"p99_latency": "8.05ms",
168+
"cpu": "6849.2%",
169+
"memory": "80.4MiB",
170170
"connections": 4096,
171171
"threads": 64,
172172
"duration": "5s",
173173
"pipeline": 1,
174-
"bandwidth": "310.61MB/s",
174+
"bandwidth": "318.76MB/s",
175175
"reconnects": 0,
176-
"status_2xx": 15817715,
176+
"status_2xx": 16234537,
177177
"status_3xx": 0,
178178
"status_4xx": 0,
179179
"status_5xx": 0

site/data/baseline-512.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -162,18 +162,18 @@
162162
{
163163
"framework": "h2o",
164164
"language": "C",
165-
"rps": 2706107,
166-
"avg_latency": "188us",
167-
"p99_latency": "1.31ms",
168-
"cpu": "6747.4%",
169-
"memory": "55.8MiB",
165+
"rps": 2768745,
166+
"avg_latency": "184us",
167+
"p99_latency": "1.20ms",
168+
"cpu": "6565.5%",
169+
"memory": "54.9MiB",
170170
"connections": 512,
171171
"threads": 64,
172172
"duration": "5s",
173173
"pipeline": 1,
174-
"bandwidth": "265.73MB/s",
174+
"bandwidth": "271.73MB/s",
175175
"reconnects": 0,
176-
"status_2xx": 13530535,
176+
"status_2xx": 13843729,
177177
"status_3xx": 0,
178178
"status_4xx": 0,
179179
"status_5xx": 0

site/data/baseline-h2-1024.json

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@
2222
{
2323
"framework": "aspnet-minimal",
2424
"language": "C#",
25-
"rps": 198526,
26-
"avg_latency": "424.18ms",
27-
"p99_latency": "424.18ms",
28-
"cpu": "11525.2%",
29-
"memory": "2.2GiB",
25+
"rps": 204357,
26+
"avg_latency": "373.55ms",
27+
"p99_latency": "373.55ms",
28+
"cpu": "11707.1%",
29+
"memory": "1.9GiB",
3030
"connections": 1024,
3131
"threads": 64,
3232
"duration": "5s",
3333
"pipeline": 1,
34-
"bandwidth": "5.35MB/s",
34+
"bandwidth": "5.50MB/s",
3535
"reconnects": 0,
36-
"status_2xx": 992634,
36+
"status_2xx": 1021787,
3737
"status_3xx": 0,
3838
"status_4xx": 0,
3939
"status_5xx": 0
@@ -62,18 +62,18 @@
6262
{
6363
"framework": "drogon",
6464
"language": "C++",
65-
"rps": 11253340,
66-
"avg_latency": "9.27ms",
67-
"p99_latency": "9.27ms",
68-
"cpu": "4875.7%",
69-
"memory": "364.7MiB",
65+
"rps": 14386780,
66+
"avg_latency": "6.79ms",
67+
"p99_latency": "6.79ms",
68+
"cpu": "5102.7%",
69+
"memory": "390.4MiB",
7070
"connections": 1024,
7171
"threads": 64,
7272
"duration": "5s",
7373
"pipeline": 1,
74-
"bandwidth": "1.56GB/s",
74+
"bandwidth": "2.00GB/s",
7575
"reconnects": 0,
76-
"status_2xx": 56266700,
76+
"status_2xx": 71933900,
7777
"status_3xx": 0,
7878
"status_4xx": 0,
7979
"status_5xx": 0
@@ -82,18 +82,18 @@
8282
{
8383
"framework": "h2o",
8484
"language": "C",
85-
"rps": 9387640,
86-
"avg_latency": "5.02ms",
87-
"p99_latency": "5.02ms",
88-
"cpu": "2063.4%",
89-
"memory": "200.9MiB",
85+
"rps": 14329780,
86+
"avg_latency": "3.58ms",
87+
"p99_latency": "3.58ms",
88+
"cpu": "2556.3%",
89+
"memory": "198.0MiB",
9090
"connections": 1024,
9191
"threads": 64,
9292
"duration": "5s",
9393
"pipeline": 1,
94-
"bandwidth": "232.78MB/s",
94+
"bandwidth": "355.33MB/s",
9595
"reconnects": 0,
96-
"status_2xx": 46938200,
96+
"status_2xx": 71648900,
9797
"status_3xx": 0,
9898
"status_4xx": 0,
9999
"status_5xx": 0
@@ -142,18 +142,18 @@
142142
{
143143
"framework": "nginx",
144144
"language": "C",
145-
"rps": 3315310,
146-
"avg_latency": "20.26ms",
147-
"p99_latency": "20.26ms",
148-
"cpu": "6456.5%",
145+
"rps": 3407369,
146+
"avg_latency": "21.61ms",
147+
"p99_latency": "21.61ms",
148+
"cpu": "6927.2%",
149149
"memory": "3.5GiB",
150150
"connections": 1024,
151151
"threads": 64,
152152
"duration": "5s",
153153
"pipeline": 1,
154-
"bandwidth": "271.92MB/s",
154+
"bandwidth": "279.47MB/s",
155155
"reconnects": 0,
156-
"status_2xx": 16576553,
156+
"status_2xx": 17036845,
157157
"status_3xx": 0,
158158
"status_4xx": 0,
159159
"status_5xx": 0

site/data/baseline-h2-2048.json

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
[
2+
{
3+
"framework": "h2o",
4+
"language": "C",
5+
"rps": 13938980,
6+
"avg_latency": "8.38ms",
7+
"p99_latency": "8.38ms",
8+
"cpu": "2680.3%",
9+
"memory": "268.9MiB",
10+
"connections": 2048,
11+
"threads": 64,
12+
"duration": "5s",
13+
"pipeline": 1,
14+
"bandwidth": "345.65MB/s",
15+
"reconnects": 0,
16+
"status_2xx": 69694900,
17+
"status_3xx": 0,
18+
"status_4xx": 0,
19+
"status_5xx": 0
20+
}
21+
]

0 commit comments

Comments
 (0)