mirror of
https://passt.top/passt
synced 2025-05-23 17:55:34 +02:00
test/perf: Start iperf3 server less often
Currently we start both the iperf3 server(s) and client(s) afresh each time we want to make a bandwidth measurement. That's not really necessary as usually a whole batch of bandwidth measurements can use the same server. Split up the iperf3 directive into 3 directives: iperf3s to start the server, iperf3 to make a measurement and iperf3k to kill the server, so that we can start the server less often. This - and more importantly, the reduced number of waits for the server to be ready - reduces runtime of the performance tests on my laptop by about 4m (out of ~28minutes). For now we still restart the server between IPv4 and IPv6 tests. That's because in some cases the latency measurements we make in between use the same ports. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
f9ff6678d4
commit
e516809a74
5 changed files with 214 additions and 110 deletions
test/lib
|
@ -13,19 +13,45 @@
|
|||
# Copyright (c) 2021 Red Hat GmbH
|
||||
# Author: Stefano Brivio <sbrivio@redhat.com>
|
||||
|
||||
# test_iperf3s() - Start iperf3 server
|
||||
# $1: Destination/server context
|
||||
# $2: Port number, ${i} is translated to process index
|
||||
# $3: Number of processes to run in parallel
|
||||
test_iperf3s() {
|
||||
__sctx="${1}"
|
||||
__port="${2}"
|
||||
__procs="$((${3} - 1))"
|
||||
|
||||
pane_or_context_run_bg "${__sctx}" \
|
||||
'for i in $(seq 0 '${__procs}'); do' \
|
||||
' iperf3 -s -p'${__port}' &' \
|
||||
' echo $! > s${i}.pid; ' \
|
||||
'done' \
|
||||
|
||||
sleep 1 # Wait for server to be ready
|
||||
}
|
||||
|
||||
# test_iperf3k() - Kill iperf3 server
|
||||
# $1: Destination/server context
|
||||
test_iperf3k() {
|
||||
__sctx="${1}"
|
||||
|
||||
pane_or_context_run "${__sctx}" 'kill -INT $(cat s*.pid); rm s*.pid'
|
||||
|
||||
sleep 3 # Wait for kernel to free up ports
|
||||
}
|
||||
|
||||
# test_iperf3() - Ugly helper for iperf3 directive
|
||||
# $1: Variable name: to put the measure bandwidth into
|
||||
# $2: Source/client context
|
||||
# $3: Destination/server context
|
||||
# $4: Destination name or address for client
|
||||
# $5: Port number, ${i} is translated to process index
|
||||
# $6: Number of processes to run in parallel
|
||||
# $7: Run time, in seconds
|
||||
# $3: Destination name or address for client
|
||||
# $4: Port number, ${i} is translated to process index
|
||||
# $5: Number of processes to run in parallel
|
||||
# $6: Run time, in seconds
|
||||
# $@: Client options
|
||||
test_iperf3() {
|
||||
__var="${1}"; shift
|
||||
__cctx="${1}"; shift
|
||||
__sctx="${1}"; shift
|
||||
__dest="${1}"; shift
|
||||
__port="${1}"; shift
|
||||
__procs="$((${1} - 1))"; shift
|
||||
|
@ -33,14 +59,6 @@ test_iperf3() {
|
|||
|
||||
pane_or_context_run "${__cctx}" 'rm -f c*.json'
|
||||
|
||||
pane_or_context_run_bg "${__sctx}" \
|
||||
'for i in $(seq 0 '${__procs}'); do' \
|
||||
' (iperf3 -s1 -p'${__port}' -i'${__time}') &' \
|
||||
' echo $! > s${i}.pid; ' \
|
||||
'done' \
|
||||
|
||||
sleep 1 # Wait for server to be ready
|
||||
|
||||
# A 1s wait for connection on what's basically a local link
|
||||
# indicates something is pretty wrong
|
||||
__timeout=1000
|
||||
|
@ -55,17 +73,12 @@ test_iperf3() {
|
|||
' wait' \
|
||||
')'
|
||||
|
||||
# Kill the server, just in case -1 didn't work right
|
||||
pane_or_context_run "${__sctx}" 'kill -INT $(cat s*.pid); rm s*.pid'
|
||||
|
||||
__jval=".end.sum_received.bits_per_second"
|
||||
|
||||
__bw=$(pane_or_context_output "${__cctx}" \
|
||||
'cat c*.json | jq -rMs "map('${__jval}') | add"')
|
||||
|
||||
TEST_ONE_subs="$(list_add_pair "${TEST_ONE_subs}" "__${__var}__" "${__bw}" )"
|
||||
|
||||
sleep 3 # Wait for kernel to free up ports
|
||||
}
|
||||
|
||||
test_one_line() {
|
||||
|
@ -283,6 +296,12 @@ test_one_line() {
|
|||
"lat")
|
||||
table_value_latency ${__arg} || TEST_ONE_perf_nok=1
|
||||
;;
|
||||
"iperf3s")
|
||||
test_iperf3s ${__arg}
|
||||
;;
|
||||
"iperf3k")
|
||||
test_iperf3k ${__arg}
|
||||
;;
|
||||
"iperf3")
|
||||
test_iperf3 ${__arg}
|
||||
;;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue