Trying with rt-threading turned on.
This commit is contained in:
parent
7d88de4963
commit
6abd91837f
89
Cargo.lock
generated
89
Cargo.lock
generated
@ -1,5 +1,11 @@
|
||||
# This file is automatically @generated by Cargo.
|
||||
# It is not intended for manual editing.
|
||||
[[package]]
|
||||
name = "arc-swap"
|
||||
version = "0.4.5"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "d663a8e9a99154b5fb793032533f6328da35e23aac63d5c152279aa8ba356825"
|
||||
|
||||
[[package]]
|
||||
name = "atty"
|
||||
version = "0.2.11"
|
||||
@ -320,6 +326,15 @@ dependencies = [
|
||||
"http",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "hermit-abi"
|
||||
version = "0.1.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "725cf19794cf90aa94e65050cb4191ff5d8fa87a498383774c47b332e3af952e"
|
||||
dependencies = [
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "http"
|
||||
version = "0.2.1"
|
||||
@ -523,12 +538,35 @@ dependencies = [
|
||||
"kernel32-sys",
|
||||
"libc",
|
||||
"log 0.4.8",
|
||||
"miow",
|
||||
"miow 0.2.1",
|
||||
"net2",
|
||||
"slab",
|
||||
"winapi 0.2.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio-named-pipes"
|
||||
version = "0.1.6"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "f5e374eff525ce1c5b7687c4cef63943e7686524a387933ad27ca7ec43779cb3"
|
||||
dependencies = [
|
||||
"log 0.4.8",
|
||||
"mio",
|
||||
"miow 0.3.3",
|
||||
"winapi 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "mio-uds"
|
||||
version = "0.6.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "966257a94e196b11bb43aca423754d87429960a768de9414f3691d6957abf125"
|
||||
dependencies = [
|
||||
"iovec",
|
||||
"libc",
|
||||
"mio",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miow"
|
||||
version = "0.2.1"
|
||||
@ -541,6 +579,16 @@ dependencies = [
|
||||
"ws2_32-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "miow"
|
||||
version = "0.3.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "396aa0f2003d7df8395cb93e09871561ccc3e785f0acb369170e8cc74ddf9226"
|
||||
dependencies = [
|
||||
"socket2",
|
||||
"winapi 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "multipart"
|
||||
version = "0.16.1"
|
||||
@ -589,6 +637,16 @@ dependencies = [
|
||||
"autocfg 1.0.0",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "num_cpus"
|
||||
version = "1.12.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "46203554f085ff89c235cd12f7075f3233af9b11ed7c9e16dfe2560d03313ce6"
|
||||
dependencies = [
|
||||
"hermit-abi",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "numtoa"
|
||||
version = "0.1.0"
|
||||
@ -959,6 +1017,16 @@ dependencies = [
|
||||
"opaque-debug",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "signal-hook-registry"
|
||||
version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "94f478ede9f64724c5d173d7bb56099ec3e2d9fc2774aac65d34b8b890405f41"
|
||||
dependencies = [
|
||||
"arc-swap",
|
||||
"libc",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "siphasher"
|
||||
version = "0.2.3"
|
||||
@ -977,6 +1045,18 @@ version = "1.2.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "5c2fb2ec9bcd216a5b0d0ccf31ab17b5ed1d627960edff65bbe95d3ce221cefc"
|
||||
|
||||
[[package]]
|
||||
name = "socket2"
|
||||
version = "0.3.12"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "03088793f677dce356f3ccc2edb1b314ad191ab702a5de3faf49304f7e104918"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"redox_syscall",
|
||||
"winapi 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "stderrlog"
|
||||
version = "0.4.3"
|
||||
@ -1068,11 +1148,17 @@ dependencies = [
|
||||
"futures-core",
|
||||
"iovec",
|
||||
"lazy_static 1.4.0",
|
||||
"libc",
|
||||
"memchr",
|
||||
"mio",
|
||||
"mio-named-pipes",
|
||||
"mio-uds",
|
||||
"num_cpus",
|
||||
"pin-project-lite",
|
||||
"signal-hook-registry",
|
||||
"slab",
|
||||
"tokio-macros",
|
||||
"winapi 0.3.8",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1291,6 +1377,7 @@ dependencies = [
|
||||
name = "warptest"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"num_cpus",
|
||||
"stderrlog",
|
||||
"tokio",
|
||||
"warp",
|
||||
|
||||
@ -8,5 +8,6 @@ edition = "2018"
|
||||
|
||||
[dependencies]
|
||||
warp = "0.2.2"
|
||||
tokio = { version = "0.2", features = ["macros"] }
|
||||
tokio = { version = "0.2", features = ["full"] }
|
||||
stderrlog = "0.4.3"
|
||||
num_cpus = "1.12.0"
|
||||
|
||||
53
README.md
53
README.md
@ -1,72 +1,75 @@
|
||||
# CPU Info
|
||||
## Logical CPUs 8
|
||||
## Physical CPUs 4
|
||||
|
||||
# Benchmark results
|
||||
## Sleep:
|
||||
### `wrk -t 16 -d 5 -c 16 http://localhost:3030/sleep/1`
|
||||
### `wrk -t 16 -d 5 --timeout 5 -c 16 http://localhost:3030/sleep/1`
|
||||
|
||||
```
|
||||
Running 5s test @ http://localhost:3030/sleep/1
|
||||
16 threads and 16 connections
|
||||
Thread Stats Avg Stdev Max +/- Stdev
|
||||
Latency 1.00s 332.22us 1.00s 68.75%
|
||||
Req/Sec 0.50 0.50 1.00 100.00%
|
||||
Latency 1.00s 529.36us 1.00s 70.31%
|
||||
Req/Sec 0.28 0.45 1.00 71.88%
|
||||
64 requests in 5.01s, 8.50KB read
|
||||
Requests/sec: 12.78
|
||||
Transfer/sec: 1.70KB
|
||||
```
|
||||
|
||||
## Sleep:
|
||||
### `wrk -t 16 -d 5 -c 32 http://localhost:3030/sleep/1`
|
||||
### `wrk -t 16 -d 5 --timeout 5 -c 32 http://localhost:3030/sleep/1`
|
||||
|
||||
```
|
||||
Running 5s test @ http://localhost:3030/sleep/1
|
||||
16 threads and 32 connections
|
||||
Thread Stats Avg Stdev Max +/- Stdev
|
||||
Latency 1.00s 519.72us 1.00s 68.75%
|
||||
Req/Sec 2.34 2.92 10.00 87.67%
|
||||
128 requests in 5.01s, 17.00KB read
|
||||
Requests/sec: 25.57
|
||||
Transfer/sec: 3.40KB
|
||||
Latency 1.00s 519.15us 1.00s 64.03%
|
||||
Req/Sec 3.48 3.96 10.00 73.47%
|
||||
139 requests in 5.10s, 18.46KB read
|
||||
Requests/sec: 27.26
|
||||
Transfer/sec: 3.62KB
|
||||
```
|
||||
|
||||
## Sleep:
|
||||
### `wrk -t 16 -d 5 -c 64 http://localhost:3030/sleep/1`
|
||||
### `wrk -t 16 -d 5 --timeout 5 -c 64 http://localhost:3030/sleep/1`
|
||||
|
||||
```
|
||||
Running 5s test @ http://localhost:3030/sleep/1
|
||||
16 threads and 64 connections
|
||||
Thread Stats Avg Stdev Max +/- Stdev
|
||||
Latency 1.00s 1.64ms 1.01s 72.27%
|
||||
Req/Sec 3.52 3.38 30.00 96.92%
|
||||
Latency 1.00s 0.85ms 1.00s 65.23%
|
||||
Req/Sec 5.75 8.14 30.00 90.14%
|
||||
256 requests in 5.01s, 34.00KB read
|
||||
Requests/sec: 51.13
|
||||
Requests/sec: 51.14
|
||||
Transfer/sec: 6.79KB
|
||||
```
|
||||
|
||||
## Sleep:
|
||||
### `wrk -t 16 -d 5 -c 128 http://localhost:3030/sleep/1`
|
||||
### `wrk -t 16 -d 5 --timeout 5 -c 128 http://localhost:3030/sleep/1`
|
||||
|
||||
```
|
||||
Running 5s test @ http://localhost:3030/sleep/1
|
||||
16 threads and 128 connections
|
||||
Thread Stats Avg Stdev Max +/- Stdev
|
||||
Latency 1.00s 0.96ms 1.01s 70.70%
|
||||
Req/Sec 10.38 15.10 70.00 94.12%
|
||||
Latency 1.00s 708.55us 1.00s 68.55%
|
||||
Req/Sec 13.17 19.52 70.00 88.89%
|
||||
512 requests in 5.01s, 68.00KB read
|
||||
Requests/sec: 102.17
|
||||
Transfer/sec: 13.57KB
|
||||
Requests/sec: 102.26
|
||||
Transfer/sec: 13.58KB
|
||||
```
|
||||
|
||||
## Spin:
|
||||
### `wrk -t 16 -d 5 -c 16 http://localhost:3030/spin/1`
|
||||
### `wrk -t 16 -d 5 --timeout 5 -c 16 http://localhost:3030/spin/1`
|
||||
|
||||
```
|
||||
Running 5s test @ http://localhost:3030/spin/1
|
||||
16 threads and 16 connections
|
||||
Thread Stats Avg Stdev Max +/- Stdev
|
||||
Latency 1.00s 0.00us 1.00s 100.00%
|
||||
Req/Sec 0.20 0.45 1.00 80.00%
|
||||
5 requests in 5.10s, 760.00B read
|
||||
Socket errors: connect 0, read 0, write 0, timeout 4
|
||||
Requests/sec: 0.98
|
||||
Transfer/sec: 149.02B
|
||||
Latency 2.70s 1.42s 5.00s 60.00%
|
||||
Req/Sec 0.00 0.00 0.00 100.00%
|
||||
20 requests in 5.10s, 2.97KB read
|
||||
Requests/sec: 3.92
|
||||
Transfer/sec: 596.05B
|
||||
```
|
||||
|
||||
|
||||
@ -1,4 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
WRK="wrk -t 16 -d 5 --timeout 5"
|
||||
|
||||
function block_quote() {
|
||||
echo "\`\`\`"
|
||||
@ -12,9 +15,14 @@ echo "Running webserver on port :3030"
|
||||
PID=$!
|
||||
echo "PID ${PID:?}"
|
||||
|
||||
echo "# Benchmark results" > README.md
|
||||
{
|
||||
curl -s 'http://localhost:3030/info'
|
||||
echo ""
|
||||
}> README.md
|
||||
echo "# Benchmark results" >> README.md
|
||||
|
||||
for CONNECTIONS in 16 32 64 128; do
|
||||
SLEEP_CMD="wrk -t 16 -d 5 -c ${CONNECTIONS} http://localhost:3030/sleep/1"
|
||||
SLEEP_CMD="${WRK:?} -c ${CONNECTIONS} http://localhost:3030/sleep/1"
|
||||
{
|
||||
echo "## Sleep:"
|
||||
echo "### \`${SLEEP_CMD:?}\`"
|
||||
@ -24,7 +32,7 @@ echo ""
|
||||
} >> README.md
|
||||
done
|
||||
|
||||
SPIN_CMD="wrk -t 16 -d 5 -c 16 http://localhost:3030/spin/1"
|
||||
SPIN_CMD="${WRK:?} -c 16 http://localhost:3030/spin/1"
|
||||
{
|
||||
echo "## Spin:"
|
||||
echo "### \`${SPIN_CMD:?}\`"
|
||||
|
||||
10
src/main.rs
10
src/main.rs
@ -20,6 +20,14 @@ async fn main() {
|
||||
.and_then(sleepy);
|
||||
// Match `/spin/:Seconds`... and burn CPU for N seconds...
|
||||
let spin = warp::path("spin").and(warp::path::param()).and_then(spin);
|
||||
let info = warp::path("info").map(||{
|
||||
format!(r#"# CPU Info
|
||||
## Logical CPUs {}
|
||||
## Physical CPUs {}
|
||||
"#,
|
||||
num_cpus::get(),
|
||||
num_cpus::get_physical())
|
||||
});
|
||||
let index = warp::any().map(|| {
|
||||
warp::http::Response::builder()
|
||||
.header("content-type", "text/html; charset=utf-8")
|
||||
@ -30,7 +38,7 @@ async fn main() {
|
||||
"#,
|
||||
)
|
||||
});
|
||||
let routes = sleepy.or(spin).or(index);
|
||||
let routes = info.or(sleepy).or(spin).or(index);
|
||||
let routes = routes.with(warp::log("warptest"));
|
||||
|
||||
println!("Listening on :3030");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user