From a27f4fc4c92f05974b3a80b0a89cfea5a33c8fd6 Mon Sep 17 00:00:00 2001 From: Norwin Date: Sun, 2 Jan 2022 06:18:25 +0100 Subject: [PATCH 1/2] add some contrib scripts --- contrib/pixelvnc.sh | 16 ++++++++++++++++ contrib/setup_bbr.sh | 32 ++++++++++++++++++++++++++++++++ rpc/test.sh | 29 ----------------------------- 3 files changed, 48 insertions(+), 29 deletions(-) create mode 100755 contrib/pixelvnc.sh create mode 100755 contrib/setup_bbr.sh delete mode 100755 rpc/test.sh diff --git a/contrib/pixelvnc.sh b/contrib/pixelvnc.sh new file mode 100755 index 0000000..7b0065e --- /dev/null +++ b/contrib/pixelvnc.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# run vnc viewer in fullscreen on the selected monitor. +# restarts it on connectivity issues, press ctrl-c TWICE to quit. +# +# usage: pixelvnc.sh [[:] [monitor-index]] +# depends on: tigervnc + +host=${1:=vnc.schenklklopfer.de} +screen=${2:=1} + +while :; do + vncviewer ReconnectOnError=0 ViewOnly=1 FullScreen=1 FullScreenMode=Selected FullScreenSelectedMonitors=$screen $host + sleep 1 # give room to ^C out of the loop +done + diff --git a/contrib/setup_bbr.sh b/contrib/setup_bbr.sh new file mode 100755 index 0000000..7ea2f6a --- /dev/null +++ b/contrib/setup_bbr.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# sets up BBR congestion control (https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=0f8782ea14974ce992618b55f0c041ef43ed0b78) +# for the given interface + +DEV=${$1:=eth0} +MODE=${$2:="temporary"} + +echo pre-run state: +echo `sysctl net.ipv4.tcp_congestion_control` +echo qdisc on $DEV: `tc qdisc show dev $DEV` + +# set required "fair queueing" queuing discipline (man tc-fq) +echo "qdisc on $DEV was: `tc qdisc show dev $DEV`" +tc qdisc replace dev $DEV root fq +echo "qdisc on $DEV now is: `tc qdisc show dev $DEV`" + +# (permanently) configure BBR +if [[ mode == "temporary" ]]; then + echo -e 'net.core.default_qdisc=fq + net.ipv4.tcp_congestion_control=bbr' | sysctl -p- +elif [[ mode == "permanent"]]; then + echo -e 'net.core.default_qdisc=fq + net.ipv4.tcp_congestion_control=bbr' >> /etc/sysctl.d/20-net-bbr.conf + sysctl -p /etc/sysctl.d/20-net-bbr.conf + algo=`sysctl net.ipv4.tcp_congestion_control` + if [[ "$algo" != 'net.ipv4.tcp_congestion_control = bbr' ]]; then + echo "couldn't apply changes at runtime, you should reboot." + fi +else + echo "unknown mode, congestion control algo unchanged" +fi diff --git a/rpc/test.sh b/rpc/test.sh deleted file mode 100755 index d3b307a..0000000 --- a/rpc/test.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# runs two instances of hochwasser (rpc server & client each) against a fake (iperf) -# pixelflut server for a few seconds, and opens pprof afterwar - -runtime=${1:-"2s"} - -function cleanup { - kill ${pids[@]} > /dev/null 2>&1 -} -trap cleanup EXIT - -wd=$(dirname "$0") -pids=() - -iperf -p 1337 -s > /dev/null 2>&1 & -pids+=($!) - -go run . -image $wd/../benchmarks/black_small.png -rán :1234 & -pids+=($!) -sleep 0.2 - -go run . -image $wd/../benchmarks/white_small.png -hevring :1234 -runtime "$runtime" -cpuprofile hevring.prof -pids+=($!) - -cleanup - -go tool pprof -http :8080 Hochwasser hevring.prof -#go tool pprof -http :8081 Hochwasser ran.prof From 0640f1733be2e623f3ec890ba75646fe19f1c193 Mon Sep 17 00:00:00 2001 From: Norwin Date: Wed, 5 Jan 2022 23:21:35 +0100 Subject: [PATCH 2/2] readd testscript --- contrib/test.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100755 contrib/test.sh diff --git a/contrib/test.sh b/contrib/test.sh new file mode 100755 index 0000000..d3b307a --- /dev/null +++ b/contrib/test.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +# runs two instances of hochwasser (rpc server & client each) against a fake (iperf) +# pixelflut server for a few seconds, and opens pprof afterwar + +runtime=${1:-"2s"} + +function cleanup { + kill ${pids[@]} > /dev/null 2>&1 +} +trap cleanup EXIT + +wd=$(dirname "$0") +pids=() + +iperf -p 1337 -s > /dev/null 2>&1 & +pids+=($!) + +go run . -image $wd/../benchmarks/black_small.png -rán :1234 & +pids+=($!) +sleep 0.2 + +go run . -image $wd/../benchmarks/white_small.png -hevring :1234 -runtime "$runtime" -cpuprofile hevring.prof +pids+=($!) + +cleanup + +go tool pprof -http :8080 Hochwasser hevring.prof +#go tool pprof -http :8081 Hochwasser ran.prof