Skip to content

Commit aaf3082

Browse files
committed
stunnel perf scripts
Signed-off-by: Edwin Török <[email protected]>
1 parent d27a118 commit aaf3082

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

scripts/stunnel-perf/benchmark.sh

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/bin/sh
2+
# Set a machine into benchmarking mode.
3+
#
4+
# For native Linux, and Intel-only for now (AMD has a different way of disabling turbo)
5+
#
6+
# References: https://llvm.org/docs/Benchmarking.html
7+
8+
declare -a packages=(
9+
"cpupower" "tuned" "ss" "turbostat" "lscpu" "lspci" "ip" "ethtool" "jq" "nginx" "hitch" "stunnel" "iperf3" "nuttcp" "httping" "git" "hyperfine"
10+
)
11+
12+
install_packages()
13+
{
14+
# This is for Fedora 42, adapt for your own OS
15+
sudo dnf install "${packages[@]}"
16+
}
17+
18+
stop_services()
19+
{
20+
sudo cp /lib/systemd/system/rescue.target /lib/systemd/system/benchmark.target
21+
sudo systemctl add-wants benchmark.target sshd.service
22+
sudo systemctl isolate benchmark.target
23+
sudo systemctl list-units --state=running
24+
}
25+
26+
start_services()
27+
{
28+
sudo systemctl isolate multi-user.target
29+
}
30+
31+
set_cpu()
32+
{
33+
# Prevent frequency-scaling
34+
sudo cpupower frequency-set -g performance
35+
36+
# Prevent entering C-states to reduce latency and avoid menu governor bugs (there was one recently)
37+
sudo cpupower idle-set -D 0
38+
39+
# Disable Turbo Boost for more stable measurements
40+
# cpupower set --turbo-boost 0 doesn't work when the driver is intel_pstate instead of cpufreq
41+
sudo sh -c 'echo 1 >/sys/devices/system/cpu/intel_pstate/no_turbo'
42+
43+
sudo cpupower -c all set --perf-bias 0
44+
45+
# Bring system into a consistent state
46+
# TODO: switch and reboot between the two
47+
#sudo tuned-adm profile network-latency
48+
49+
sudo tuned-adm profile network-throughput
50+
51+
# we could use tuned-adm verify, but there is a bug where it tries to read non-existent hung_task_timeout_secs
52+
}
53+
54+
describe()
55+
{
56+
# Check all the settings we've changed above
57+
58+
# List running processes
59+
set -x
60+
sudo systemctl list-units --state=running
61+
LIBPROC_HIDE_KERNEL=1 ps -ejH
62+
63+
sudo cpupower -c all frequency-info
64+
sudo cpupower -c all idle-info
65+
sudo cpupower -c all info
66+
sudo cat /sys/devices/system/cpu/intel_pstate/no_turbo
67+
sudo tuned-adm profile_info
68+
sudo ss -neopatium
69+
70+
lscpu
71+
sudo turbostat true
72+
sudo lspci -k
73+
sudo ip a
74+
75+
for P in /sys/class/net/*; do
76+
IFACE=$(basename "${P}")
77+
sudo ethtool "${IFACE}"
78+
sudo ethtool -k "${IFACE}"
79+
done
80+
81+
sudo sos report --batch
82+
83+
set +x
84+
}
85+
86+
open_ports()
87+
{
88+
# iperf3, nuttcp
89+
for P in 5201 5000 5001 5101 5102 5103 5104; do
90+
sudo firewall-cmd --add-port "${P}/tcp"
91+
done
92+
}
93+
94+
iperf3_server()
95+
{
96+
iperf3 -s
97+
}
98+
99+
iperf3_client()
100+
{
101+
# TODO: autodetect IP
102+
iperf3 --json --logfile iperf3.json -c 10.70.58.43
103+
}
104+
105+

0 commit comments

Comments
 (0)