From 4a1da9be7fdff51ecc8b24e7c5331883d895937f Mon Sep 17 00:00:00 2001 From: Yujia Qiao Date: Tue, 28 Dec 2021 20:04:54 +0800 Subject: docs: update benchmark and add about memory usage --- docs/benchmark.md | 75 ++++++++++++++++++++++++++++++++++--------- docs/img/http_throughput.svg | 1 + docs/img/mem-graph.png | Bin 0 -> 4661 bytes docs/img/tcp_bitrate.svg | 2 +- docs/img/tcp_latency.svg | 1 - docs/img/udp_bitrate.svg | 1 + 6 files changed, 63 insertions(+), 17 deletions(-) create mode 100644 docs/img/http_throughput.svg create mode 100644 docs/img/mem-graph.png delete mode 100644 docs/img/tcp_latency.svg create mode 100644 docs/img/udp_bitrate.svg (limited to 'docs') diff --git a/docs/benchmark.md b/docs/benchmark.md index 71816a1..4a62089 100644 --- a/docs/benchmark.md +++ b/docs/benchmark.md @@ -1,17 +1,19 @@ # Benchmark -> Date: 2021/12/14 +> Date: 2021/12/28 +> +> Version: commit 1180c7e538564efd69742f22e77453a1b74a5ed2 > -> Arch Linux with 5.15.7-arch1-1 kernel +> Arch Linux with 5.15.11-arch2-1 kernel > -> Intel i7-6600U CPU @ 2.60GHz +> Intel Xeon CPU E5-2620 @ 2.00GHz *2 > -> 20GB RAM - +> 16GB RAM -## Bitrate +## Bandwidth ![tcp_bitrate](./img/tcp_bitrate.svg) +![udp_bitrate](./img/udp_bitrate.svg) rathole with the following configuration: ```toml @@ -19,14 +21,20 @@ rathole with the following configuration: remote_addr = "localhost:2333" default_token = "123" -[client.services.foo1] +[client.services.bench-tcp] +local_addr = "127.0.0.1:80" +[client.services.bench-udp] +type = "udp" local_addr = "127.0.0.1:80" [server] bind_addr = "0.0.0.0:2333" default_token = "123" -[server.services.foo1] +[server.services.bench-tcp] +bind_addr = "0.0.0.0:5202" +[server.services.bench-udp] +type = "udp" bind_addr = "0.0.0.0:5202" ``` @@ -41,16 +49,20 @@ token = 1233 # frpc.ini [common] server_addr = 127.0.0.1 -#server_addr = 47.100.208.60 server_port = 7000 authentication_method = token token = 1233 -[ssh] +[bench-tcp] type = tcp local_ip = 127.0.0.1 local_port = 80 remote_port = 5203 +[bench-udp] +type = udp +local_ip = 127.0.0.1 +local_port = 80 +remote_port = 5203 ``` ``` @@ -71,17 +83,50 @@ For frp benchmark: $ iperf3 -c 127.0.0.1 -p 5203 ``` -## Latency +## HTTP nginx/1.20.2 listens on port 80, with the default test page. frp and rathole configuration is same with the previous section. -Using [ali](https://github.com/nakabonne/ali) with different rate. +[vegeta](https://github.com/tsenart/vegeta) is used to generate HTTP load. + +### HTTP Throughput + +The following commands are used to benchmark rathole and frp. Note that if you want to do a benchmark yourself, `-max-workers` should be adjusted to get the accurate results for your machine. -e.g. for rathole 10 QPS benchmark: ``` -ali -r 10 http://127.0.0.1:5202 +echo 'GET http://127.0.0.1:5203' | vegeta attack -rate 0 -duration 30s -max-workers 48 +echo 'GET http://127.0.0.1:5202' | vegeta attack -rate 0 -duration 30s -max-workers 48 ``` -![tcp_latency](./img/tcp_latency.svg) +![http_throughput](./img/http_throughput.svg) + +### HTTP Latency + +`rathole` has very similar latency to `frp`, but can handle more connections + +Here's a table, latency is in ms + +|QPS|latency(rathole)|latency(frp)| +|--|--|---| +|1|2.113|2.55| +|1000|1.723|1.742| +|2000|1.845|1.749| +|3000|2.064|2.011| +|4000|2.569|7907| + +As you can see, for QPS from 1 to 3000, rathole and frp have nearly identical latency. +But with QPS of 4000, frp starts reporting lots of errors and the latency grows to even seconds. This kind of reflects the throughput in the previous section. + +Thus, in terms of latency, rathole and frp are nearly the same. But rathole can handle more connections. + +[Script to benchmark latency](../benches/scripts/http/latency.sh) + +## Memory Usage + +![mem](./img/mem-graph.png) + +rathole uses much less memory than frp. + +[Script to benchmark memory](../benches/scripts/mem/mem.sh) diff --git a/docs/img/http_throughput.svg b/docs/img/http_throughput.svg new file mode 100644 index 0000000..02f7c18 --- /dev/null +++ b/docs/img/http_throughput.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/docs/img/mem-graph.png b/docs/img/mem-graph.png new file mode 100644 index 0000000..c355803 Binary files /dev/null and b/docs/img/mem-graph.png differ diff --git a/docs/img/tcp_bitrate.svg b/docs/img/tcp_bitrate.svg index 6a3065a..e7f8374 100644 --- a/docs/img/tcp_bitrate.svg +++ b/docs/img/tcp_bitrate.svg @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/docs/img/tcp_latency.svg b/docs/img/tcp_latency.svg deleted file mode 100644 index 172e802..0000000 --- a/docs/img/tcp_latency.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/docs/img/udp_bitrate.svg b/docs/img/udp_bitrate.svg new file mode 100644 index 0000000..891f4a6 --- /dev/null +++ b/docs/img/udp_bitrate.svg @@ -0,0 +1 @@ + \ No newline at end of file -- cgit v1.2.3