From 51b2da96360329ad4e4957c8ab90a88b73e7b275 Mon Sep 17 00:00:00 2001 From: Bill Thiede Date: Fri, 3 Apr 2020 21:55:08 -0700 Subject: [PATCH] Compare performance of spin vs sleep. --- README.md | 27 +++++++++++++++++++++++++++ run_benches.sh | 23 +++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 README.md create mode 100755 run_benches.sh diff --git a/README.md b/README.md new file mode 100644 index 0000000..2f0f4ff --- /dev/null +++ b/README.md @@ -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 +``` diff --git a/run_benches.sh b/run_benches.sh new file mode 100755 index 0000000..9a5b88b --- /dev/null +++ b/run_benches.sh @@ -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:?}