Add tcp latency test over virtio-net

This commit is contained in:
jiangjianfeng
2024-10-12 02:09:58 +00:00
committed by Tate, Hongliang Tian
parent e78303b01a
commit 090149eed7
14 changed files with 102 additions and 9 deletions

View File

@ -70,7 +70,7 @@ run_benchmark() {
-drive if=none,format=raw,id=x0,file=${BENCHMARK_DIR}/../build/ext2.img \
-device virtio-blk-pci,bus=pcie.0,addr=0x6,drive=x0,serial=vext2,disable-legacy=on,disable-modern=off,queue-size=64,num-queues=1,config-wce=off,request-merging=off,write-cache=off,backend_defaults=off,discard=off,event_idx=off,indirect_desc=off,ioeventfd=off,queue_reset=off \
-append 'console=ttyS0 rdinit=/benchmark/common/bench_runner.sh ${benchmark} linux mitigations=off hugepages=0 transparent_hugepage=never quiet' \
-netdev user,id=net01,hostfwd=tcp::5201-:5201,hostfwd=tcp::8080-:8080 \
-netdev user,id=net01,hostfwd=tcp::5201-:5201,hostfwd=tcp::8080-:8080,hostfwd=tcp::31234-:31234 \
-device virtio-net-pci,netdev=net01,disable-legacy=on,disable-modern=off \
-nographic \
2>&1"

View File

@ -26,6 +26,9 @@ elif [[ "$BENCHMARK_PATH" =~ "nginx" ]]; then
elif [[ "$BENCHMARK_PATH" =~ "redis" ]]; then
# Persist Redis port
export REDIS_PORT=6379
elif [[ "$BENCHMARK_PATH" =~ "tcp_virtio_lat" ]]; then
# Persist lmbench/tcp_lat port
export LMBENCH_TCP_LAT_PORT=31234
fi
# Function to run the benchmark
@ -57,7 +60,7 @@ run_benchmark() {
sleep 1
# Run the host command and save the output to the specified file.
bash "${BENCHMARK_PATH}/host.sh" | tee "${output_file}"
bash "${BENCHMARK_PATH}/host.sh" 2>&1 | tee "${output_file}"
# Clean up the log file
rm -f "${guest_log_file}"

View File

@ -34,6 +34,7 @@
"tcp_loopback_bw_4k",
"tcp_loopback_bw_64k",
"tcp_loopback_lat",
"tcp_virtio_lat",
"tcp_loopback_connect_lat",
"tcp_loopback_select_lat",
"tcp_loopback_http_bw",

View File

@ -6,6 +6,6 @@ set -e
echo "*** Running lmbench TCP latency test ***"
/benchmark/bin/lmbench/lat_tcp -s
/benchmark/bin/lmbench/lat_tcp -s 127.0.0.1
/benchmark/bin/lmbench/lat_tcp -P 1 127.0.0.1
/benchmark/bin/lmbench/lat_tcp -S 127.0.0.1

View File

@ -0,0 +1,9 @@
{
"alert_threshold": "125%",
"alert_tool": "customSmallerIsBetter",
"search_pattern": "TCP latency using 127.0.0.1:",
"result_index": "5",
"description": "lat_tcp_virtio",
"title": "[TCP sockets] The latency over virtio-net",
"benchmark_type": "host_guest"
}

View File

@ -0,0 +1,21 @@
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
set -e
# Function to stop the guest VM
stop_guest() {
echo "Stopping guest VM..."
# `-r` means if there's no qemu, the kill won't be executed
pgrep qemu | xargs -r kill
}
# Trap EXIT signal to ensure guest VM is stopped on script exit
trap stop_guest EXIT
# Run lmbench tcp client
echo "Running lmbench tcp client"
/usr/local/benchmark/lmbench/lat_tcp -P 1 127.0.0.1
# The trap will automatically stop the guest VM when the script exits

View File

@ -0,0 +1,14 @@
[
{
"name": "Average TCP latency over virtio-net on Linux",
"unit": "µs",
"value": 0,
"extra": "linux_result"
},
{
"name": "Average TCP latency over virtio-net on Asterinas",
"unit": "µs",
"value": 0,
"extra": "aster_result"
}
]

View File

@ -0,0 +1,13 @@
#!/bin/sh
# SPDX-License-Identifier: MPL-2.0
set -e
echo "Running lmbench TCP latency over virtio-net..."
# Start the server
/benchmark/bin/lmbench/lat_tcp -s 10.0.2.15
# Sleep for a long time to ensure VM won't exit
sleep 200