mirror of
https://github.com/zebrajr/express.git
synced 2025-12-06 12:19:51 +01:00
32 lines
689 B
Bash
Executable File
32 lines
689 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
NODE_ENV=production node ./support/app &
|
|
pid=$!
|
|
|
|
bench() {
|
|
ab -n 5000 -c 50 -k -q http://127.0.0.1:8000$1 \
|
|
| grep "Requests per" \
|
|
| cut -d ' ' -f 7 \
|
|
| xargs echo "$2:"
|
|
}
|
|
|
|
bench_conditional() {
|
|
ab -n 5000 -c 50 -H "If-None-Match: $3" -k -q http://127.0.0.1:8000$1 \
|
|
| grep "Requests per" \
|
|
| cut -d ' ' -f 7 \
|
|
| xargs echo "$2:"
|
|
}
|
|
|
|
sleep .5
|
|
bench / "Hello World"
|
|
bench /blog "Mounted Hello World"
|
|
bench /blog/admin "Mounted 2 Hello World"
|
|
bench /middleware "Middleware"
|
|
bench /match "Router"
|
|
bench /render "Render"
|
|
bench /json "JSON tiny"
|
|
bench /json/15 "JSON small"
|
|
bench /json/50 "JSON medium"
|
|
bench /json/150 "JSON large"
|
|
|
|
kill -9 $pid |