From 427e7bc36be9e4585eaf2ab94f3abdef9ed483f8 Mon Sep 17 00:00:00 2001 From: Lars Wirzenius Date: Sun, 18 Oct 2020 16:22:26 +0300 Subject: benchmark network to other host --- benchmarker | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/benchmarker b/benchmarker index 8dd1df9..3dea077 100755 --- a/benchmarker +++ b/benchmarker @@ -43,12 +43,31 @@ network_localhost() size=10G truncate -s "$size" "$filename" - echo "Network benchmark (netcat a $size sparse file across localhost)" + echo "Network benchmark (netcat a $size sparse file to localhost)" nc -l localhost "$port" > /dev/null & /bin/time --format="%e" nc -N localhost "$port" < "$filename" rm -f "$filename" } +netbench_remote() +{ + local filename + local port + local size + local host + + filename="$(mktemp)" + host="$BENCHMARK_REMOTE" + port=3858 + size=10G + truncate -s "$size" "$filename" + + echo "Network benchmark (netcat a $size sparse file to $host)" + ssh "$host" "nc -l localhost $port > /dev/null" & + /bin/time --format="%e" nc -N localhost "$port" < "$filename" + rm -f "$filename" +} + for bench in "$@" do case "$bench" in @@ -58,6 +77,9 @@ do network-localhost) netbench_localhost ;; + network-remote) + netbench_remote + ;; *) die "unknown benchmark type $bench" ;; -- cgit v1.2.1