Compare performance of spin vs sleep.

This commit is contained in:
Bill Thiede 2020-04-03 21:55:08 -07:00
parent fddf995996
commit 51b2da9636
2 changed files with 50 additions and 0 deletions

27
README.md Normal file
View File

@ -0,0 +1,27 @@
# Benchmark results
## Sleep: wrk -t 16 -c 32 http://localhost:3030/sleep/1
```
Running 10s test @ http://localhost:3030/sleep/1
16 threads and 32 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.00s 1.02ms 1.01s 64.58%
Req/Sec 1.40 1.33 10.00 95.92%
288 requests in 10.01s, 38.25KB read
Requests/sec: 28.76
Transfer/sec: 3.82KB
```
## Spin: wrk -t 16 -c 32 http://localhost:3030/spin/1
```
Running 10s test @ http://localhost:3030/spin/1
16 threads and 32 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.00s 0.00us 1.00s 100.00%
Req/Sec 0.10 0.32 1.00 90.00%
10 requests in 10.01s, 1.48KB read
Socket errors: connect 0, read 0, write 0, timeout 9
Requests/sec: 1.00
Transfer/sec: 151.81B
```

23
run_benches.sh Executable file
View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
SLEEP_CMD="wrk -t 16 -c 32 http://localhost:3030/sleep/1"
SPIN_CMD="wrk -t 16 -c 32 http://localhost:3030/spin/1"
cargo build --release
echo "Running webserver on port :3030"
./target/release/warptest &
PID=$!
echo "PID ${PID:?}"
echo "# Benchmark results" > README.md
echo "## Sleep: ${SLEEP_CMD}" >> README.md
echo "" >> README.md
echo "\`\`\`" >> README.md
${SLEEP_CMD:?} >> README.md
echo "\`\`\`" >> README.md
echo "" >> README.md
echo "## Spin: ${SPIN_CMD}" >> README.md
echo "" >> README.md
echo "\`\`\`" >> README.md
${SPIN_CMD:?} >> README.md
echo "\`\`\`" >> README.md
echo "Killing webserver"
kill ${PID:?}