1
0
Fork 0
mirror of https://github.com/zigzap/zap.git synced 2025-10-20 15:14:08 +00:00

updated wrk stats with rust results

This commit is contained in:
Rene Schallner 2023-01-15 06:41:19 +01:00
parent fe36303681
commit 309eaaaeff
9 changed files with 103 additions and 0 deletions

View file

@ -49,10 +49,24 @@ But, how fast is it? Being blazingly fast is relative. When compared with a
simple GO HTTP server, a simple zig zap HTTP server performed really good on my
machine:
**Update**: I was intrigued comparing to a basic rust HTTP server.
Unfortunately, knowing nothing at all about rust, I couldn't find one and hence
tried to go for the one in [The Rust Programming
Language](https://doc.rust-lang.org/book/ch20-00-final-project-a-web-server.html).
Wanting it to be of a somewhat fair comparison, I opted for the multi-threaded
example. It didn't work out-of-the-box, but I got it to work and changed it to
not read files but outputting a static text just like in the other examples.
**maybe someone with rust experience** can have a look at my
[wrk/rust/hello](wrk/rust/hello) code and tell me why it's surprisingly slow, as
I expected it to be faster than the basic GO example. I'll enable the
GitHub discussions for this matter. My suspicion is the use of mutexes.
![](wrk_table_summary.png)
- zig zag was nearly 30% faster than GO
- zig zag had over 50% more throughput than GO
- let's better not talk about the rust results. I don't know what causes them.
Probably bad mutex performance.
![](wrk_summary.png)

View file

@ -14,6 +14,18 @@ You can check out the scripts I used for the tests in [./wrk](wrk/).
You can see the verbatim output of `wrk`, and some infos about the test machine
below the code snippets.
**Update**: I was intrigued comparing to a basic rust HTTP server.
Unfortunately, knowing nothing at all about rust, I couldn't find one and hence
tried to go for the one in [The Rust Programming
Language](https://doc.rust-lang.org/book/ch20-00-final-project-a-web-server.html).
Wanting it to be of a somewhat fair comparison, I opted for the multi-threaded
example. It didn't work out-of-the-box, but I got it to work and changed it to
not read files but outputting a static text just like in the other examples.
**maybe someone with rust experience** can have a look at my
[wrk/rust/hello](wrk/rust/hello) code and tell me why it's surprisingly slow, as
I expected it to be faster than the basic GO example. I'll enable the
GitHub discussions for this matter. My suspicion is the use of muteces.
![](wrk_tables.png)
### requests / sec
@ -292,6 +304,71 @@ Running 10s test @ http://127.0.0.1:8080
Requests/sec: 5004.06
Transfer/sec: 649.95KB
(base) rs@ryzen:~/code/github.com/renerocksai/zap$
(base) rs@ryzen:~/code/github.com/renerocksai/zap$ ./wrk/measure.sh rust
Finished release [optimized] target(s) in 0.00s
========================================================================
rust
========================================================================
Running 10s test @ http://127.0.0.1:7878
4 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.20ms 1.38ms 208.35ms 99.75%
Req/Sec 34.06k 2.00k 38.86k 75.25%
Latency Distribution
50% 1.32ms
75% 1.63ms
90% 1.87ms
99% 2.32ms
1356449 requests in 10.01s, 71.15MB read
Socket errors: connect 0, read 1356427, write 0, timeout 0
Requests/sec: 135446.00
Transfer/sec: 7.10MB
(base) rs@ryzen:~/code/github.com/renerocksai/zap$ ./wrk/measure.sh rust
Finished release [optimized] target(s) in 0.00s
========================================================================
rust
========================================================================
Running 10s test @ http://127.0.0.1:7878
4 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.21ms 592.89us 10.02ms 63.64%
Req/Sec 32.93k 2.91k 37.94k 80.50%
Latency Distribution
50% 1.31ms
75% 1.64ms
90% 1.90ms
99% 2.48ms
1311445 requests in 10.02s, 68.79MB read
Socket errors: connect 0, read 1311400, write 0, timeout 0
Requests/sec: 130904.50
Transfer/sec: 6.87MB
(base) rs@ryzen:~/code/github.com/renerocksai/zap$ ./wrk/measure.sh rust
Finished release [optimized] target(s) in 0.00s
========================================================================
rust
========================================================================
Running 10s test @ http://127.0.0.1:7878
4 threads and 400 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 1.26ms 2.88ms 211.74ms 99.92%
Req/Sec 33.92k 2.04k 38.99k 74.00%
Latency Distribution
50% 1.34ms
75% 1.66ms
90% 1.91ms
99% 2.38ms
1350527 requests in 10.02s, 70.84MB read
Socket errors: connect 0, read 1350474, write 0, timeout 0
Requests/sec: 134830.39
Transfer/sec: 7.07MB
```
## test machine

View file

@ -14,6 +14,11 @@ pkgs.mkShell {
pkgs.bat
pkgs.wrk
pkgs.python3
pkgs.rustc
pkgs.cargo
pkgs.gcc
pkgs.rustfmt
pkgs.clippy
];
buildInputs = [

View file

@ -31,6 +31,13 @@ if [ "$SUBJECT" = "python" ] ; then
URL=http://127.0.0.1:8080
fi
if [ "$SUBJECT" = "rust" ] ; then
cd wrk/rust/hello && cargo build --release
./target/release/hello &
PID=$!
URL=http://127.0.0.1:7878
fi
sleep 1
echo "========================================================================"
echo " $SUBJECT"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

After

Width:  |  Height:  |  Size: 12 KiB