Make all network benchmark run with tap backend and vhost on

This commit is contained in:
Jianfeng Jiang
2024-11-14 07:37:51 +00:00
committed by Tate, Hongliang Tian
parent 03aee4a7d7
commit c8c9b9753e
14 changed files with 51 additions and 25 deletions

View File

@ -63,7 +63,7 @@ run_benchmark() {
if [ -n "$aster_scheme" ] && [ "$aster_scheme" != "null" ]; then
aster_scheme_cmd="SCHEME=${aster_scheme}"
fi
local asterinas_cmd="make run BENCHMARK=${benchmark} ${aster_scheme_cmd} ENABLE_KVM=1 RELEASE_LTO=1 2>&1"
local asterinas_cmd="make run BENCHMARK=${benchmark} ${aster_scheme_cmd} ENABLE_KVM=1 RELEASE_LTO=1 NETDEV=tap VHOST=on 2>&1"
local linux_cmd="/usr/local/qemu/bin/qemu-system-x86_64 \
--no-reboot \
-smp 1 \
@ -76,8 +76,8 @@ 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,request-merging=off,backend_defaults=off,discard=off,write-zeroes=off,event_idx=off,indirect_desc=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::6379-:6379,hostfwd=tcp::8080-:8080,hostfwd=tcp::31234-:31234,hostfwd=tcp::31236-:31236 \
-device virtio-net-pci,netdev=net01,disable-legacy=on,disable-modern=off,mrg_rxbuf=off,ctrl_rx=off,ctrl_rx_extra=off,ctrl_vlan=off,ctrl_vq=off,ctrl_guest_offloads=off,ctrl_mac_addr=off,event_idx=off,queue_reset=off,guest_announce=off,indirect_desc=off \
-netdev tap,id=net01,script=${BENCHMARK_DIR}/../../tools/net/qemu-ifup.sh,downscript=${BENCHMARK_DIR}/../../tools/net/qemu-ifdown.sh,vhost=on \
-device virtio-net-pci,netdev=net01,disable-legacy=on,disable-modern=off,csum=off,guest_csum=off,ctrl_guest_offloads=off,guest_tso4=off,guest_tso6=off,guest_ecn=off,guest_ufo=off,host_tso4=off,host_tso6=off,host_ecn=off,host_ufo=off,mrg_rxbuf=off,ctrl_vq=off,ctrl_rx=off,ctrl_vlan=off,ctrl_rx_extra=off,guest_announce=off,ctrl_mac_addr=off,host_ufo=off,guest_uso4=off,guest_uso6=off,host_uso=off \
-nographic \
2>&1"
case "${benchmark_type}" in

View File

@ -62,6 +62,9 @@ run_benchmark() {
# Sleep for a short time to ensure the guest is fully ready
sleep 1
# The listening server address in guest VM
export GUEST_SERVER_IP_ADDRESS=10.0.2.15
# Run the host command and save the output to the specified file.
bash "${BENCHMARK_PATH}/host.sh" 2>&1 | tee "${output_file}"

View File

@ -14,6 +14,7 @@ stop_guest() {
trap stop_guest EXIT
# Run iperf3 client
/usr/local/benchmark/iperf/bin/iperf3 -c 127.0.0.1 -f m
echo "Running iperf3 client connected to $GUEST_SERVER_IP_ADDRESS"
/usr/local/benchmark/iperf/bin/iperf3 -c $GUEST_SERVER_IP_ADDRESS -f m
# The trap will automatically stop the guest VM when the script exits

View File

@ -15,7 +15,8 @@ stop_guest() {
trap stop_guest EXIT
# Run lmbench tcp client
echo "Running lmbench tcp client"
/usr/local/benchmark/lmbench/bw_tcp -m 65536 -P 1 127.0.0.1
echo "Running lmbench tcp client connected to $GUEST_SERVER_IP_ADDRESS"
# The -W parameter of bw_tcp refers to the number of bytes transferred during the warm-up phase.
/usr/local/benchmark/lmbench/bw_tcp -m 65536 -P 1 -W 50000000 -N 100 $GUEST_SERVER_IP_ADDRESS
# The trap will automatically stop the guest VM when the script exits

View File

@ -15,7 +15,7 @@ stop_guest() {
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
echo "Running lmbench tcp client connected to $GUEST_SERVER_IP_ADDRESS"
/usr/local/benchmark/lmbench/lat_tcp -P 1 $GUEST_SERVER_IP_ADDRESS
# The trap will automatically stop the guest VM when the script exits

View File

@ -14,6 +14,7 @@ stop_guest() {
trap stop_guest EXIT
# Run apache bench
ab -n 10000 -c 1 http://localhost:8080/index.html
echo "Running apache bench connected to $GUEST_SERVER_IP_ADDRESS"
ab -n 10000 -c 1 http://$GUEST_SERVER_IP_ADDRESS:8080/index.html
# The trap will automatically stop the guest VM when the script exits

View File

@ -14,6 +14,7 @@ stop_guest() {
trap stop_guest EXIT
# Run apache bench
ab -n 10000 -c 20 http://localhost:8080/index.html
echo "Running apache bench connected to $GUEST_SERVER_IP_ADDRESS"
ab -n 10000 -c 20 http://$GUEST_SERVER_IP_ADDRESS:8080/index.html
# The trap will automatically stop the guest VM when the script exits

View File

@ -14,6 +14,7 @@ stop_guest() {
trap stop_guest EXIT
# Run apache bench
/usr/local/redis/bin/redis-benchmark -n 100000 -c 20 -t get
echo "Running apache bench connected to $GUEST_SERVER_IP_ADDRESS"
/usr/local/redis/bin/redis-benchmark -h $GUEST_SERVER_IP_ADDRESS -n 100000 -c 20 -t get
# The trap will automatically stop the guest VM when the script exits

View File

@ -14,6 +14,7 @@ stop_guest() {
trap stop_guest EXIT
# Run apache bench
/usr/local/redis/bin/redis-benchmark -n 100000 -c 20 -t ping_inline
echo "Running apache bench connected to $GUEST_SERVER_IP_ADDRESS"
/usr/local/redis/bin/redis-benchmark -h $GUEST_SERVER_IP_ADDRESS -n 100000 -c 20 -t ping_inline
# The trap will automatically stop the guest VM when the script exits

View File

@ -13,7 +13,8 @@ stop_guest() {
# Trap EXIT signal to ensure guest VM is stopped on script exit
trap stop_guest EXIT
# Run apache bench
/usr/local/redis/bin/redis-benchmark -n 100000 -c 20 -t ping_mbulk
# Run redis bench
echo "Running redis bench connected to $GUEST_SERVER_IP_ADDRESS"
/usr/local/redis/bin/redis-benchmark -h $GUEST_SERVER_IP_ADDRESS -n 100000 -c 20 -t ping_mbulk
# The trap will automatically stop the guest VM when the script exits

View File

@ -13,7 +13,8 @@ stop_guest() {
# Trap EXIT signal to ensure guest VM is stopped on script exit
trap stop_guest EXIT
# Run apache bench
/usr/local/redis/bin/redis-benchmark -n 100000 -c 20 -t set
# Run redis bench
echo "Running redis bench connected to $GUEST_SERVER_IP_ADDRESS"
/usr/local/redis/bin/redis-benchmark -h $GUEST_SERVER_IP_ADDRESS -n 100000 -c 20 -t set
# The trap will automatically stop the guest VM when the script exits