diff --git a/.github/workflows/benchmark_asterinas.yml b/.github/workflows/benchmark_asterinas.yml index 1fbe77187..83366dc5d 100644 --- a/.github/workflows/benchmark_asterinas.yml +++ b/.github/workflows/benchmark_asterinas.yml @@ -65,6 +65,11 @@ jobs: - lmbench/udp_loopback_lat - iperf3/tcp_virtio_bw - nginx/http_req10k_conc1_bw + # Redis benchmarks + - redis/ping_inline_100k_conc20_rps + - redis/ping_mbulk_100k_conc20_rps + - redis/get_100k_conc20_rps + - redis/set_100k_conc20_rps fail-fast: false timeout-minutes: 60 container: diff --git a/test/benchmark/bench_linux_and_aster.sh b/test/benchmark/bench_linux_and_aster.sh index 65bff4a02..1e0785165 100755 --- a/test/benchmark/bench_linux_and_aster.sh +++ b/test/benchmark/bench_linux_and_aster.sh @@ -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,hostfwd=tcp::31234-:31234 \ + -netdev user,id=net01,hostfwd=tcp::5201-:5201,hostfwd=tcp::6379-:6379,hostfwd=tcp::8080-:8080,hostfwd=tcp::31234-:31234 \ -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 \ -nographic \ 2>&1" diff --git a/test/benchmark/redis/get_100k_conc20_rps/config.json b/test/benchmark/redis/get_100k_conc20_rps/config.json new file mode 100644 index 000000000..059f8fa60 --- /dev/null +++ b/test/benchmark/redis/get_100k_conc20_rps/config.json @@ -0,0 +1,9 @@ +{ + "alert_threshold": "125%", + "alert_tool": "customBiggerIsBetter", + "search_pattern": "throughput summary:", + "result_index": "3", + "description": "redis-benchmark -n 100000 -c 20 -t get", + "title": "Redis GET performance with 20 concurrency and 100000 requests in total", + "benchmark_type": "host_guest" +} \ No newline at end of file diff --git a/test/benchmark/redis/get_100k_conc20_rps/host.sh b/test/benchmark/redis/get_100k_conc20_rps/host.sh new file mode 100755 index 000000000..451403d09 --- /dev/null +++ b/test/benchmark/redis/get_100k_conc20_rps/host.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# SPDX-License-Identifier: MPL-2.0 + +set -e + +# Function to stop the guest VM +stop_guest() { + echo "Stopping guest VM..." + pgrep qemu | xargs kill +} + +# 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 get + +# The trap will automatically stop the guest VM when the script exits \ No newline at end of file diff --git a/test/benchmark/redis/get_100k_conc20_rps/result_template.json b/test/benchmark/redis/get_100k_conc20_rps/result_template.json new file mode 100644 index 000000000..7d0a4f467 --- /dev/null +++ b/test/benchmark/redis/get_100k_conc20_rps/result_template.json @@ -0,0 +1,14 @@ +[ + { + "name": "Average RPS of GET over virtio-net between Host Linux and Guest Linux", + "unit": "request per second", + "value": 0, + "extra": "linux_result" + }, + { + "name": "Average RPS of GET over virtio-net between Host Linux and Guest Asterinas", + "unit": "request per second", + "value": 0, + "extra": "aster_result" + } +] \ No newline at end of file diff --git a/test/benchmark/redis/get_100k_conc20_rps/run.sh b/test/benchmark/redis/get_100k_conc20_rps/run.sh new file mode 100644 index 000000000..4cd15355d --- /dev/null +++ b/test/benchmark/redis/get_100k_conc20_rps/run.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# SPDX-License-Identifier: MPL-2.0 + +set -e + +echo "Running redis server" +/usr/local/redis/bin/redis-server /etc/redis.conf diff --git a/test/benchmark/redis/ping_inline_100k_conc20_rps/config.json b/test/benchmark/redis/ping_inline_100k_conc20_rps/config.json new file mode 100644 index 000000000..faf655bb7 --- /dev/null +++ b/test/benchmark/redis/ping_inline_100k_conc20_rps/config.json @@ -0,0 +1,9 @@ +{ + "alert_threshold": "125%", + "alert_tool": "customBiggerIsBetter", + "search_pattern": "throughput summary:", + "result_index": "3", + "description": "redis-benchmark -n 100000 -c 20 -t ping_inline", + "title": "Redis PING INLINE performance with 20 concurrency and 100000 requests in total", + "benchmark_type": "host_guest" +} \ No newline at end of file diff --git a/test/benchmark/redis/ping_inline_100k_conc20_rps/host.sh b/test/benchmark/redis/ping_inline_100k_conc20_rps/host.sh new file mode 100755 index 000000000..fd575c66e --- /dev/null +++ b/test/benchmark/redis/ping_inline_100k_conc20_rps/host.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# SPDX-License-Identifier: MPL-2.0 + +set -e + +# Function to stop the guest VM +stop_guest() { + echo "Stopping guest VM..." + pgrep qemu | xargs kill +} + +# 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_inline + +# The trap will automatically stop the guest VM when the script exits \ No newline at end of file diff --git a/test/benchmark/redis/ping_inline_100k_conc20_rps/result_template.json b/test/benchmark/redis/ping_inline_100k_conc20_rps/result_template.json new file mode 100644 index 000000000..0fdef55a6 --- /dev/null +++ b/test/benchmark/redis/ping_inline_100k_conc20_rps/result_template.json @@ -0,0 +1,14 @@ +[ + { + "name": "Average RPS of PING_INLINE over virtio-net between Host Linux and Guest Linux", + "unit": "request per second", + "value": 0, + "extra": "linux_result" + }, + { + "name": "Average RPS of PING_INLINE over virtio-net between Host Linux and Guest Asterinas", + "unit": "request per second", + "value": 0, + "extra": "aster_result" + } +] \ No newline at end of file diff --git a/test/benchmark/redis/ping_inline_100k_conc20_rps/run.sh b/test/benchmark/redis/ping_inline_100k_conc20_rps/run.sh new file mode 100644 index 000000000..4cd15355d --- /dev/null +++ b/test/benchmark/redis/ping_inline_100k_conc20_rps/run.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# SPDX-License-Identifier: MPL-2.0 + +set -e + +echo "Running redis server" +/usr/local/redis/bin/redis-server /etc/redis.conf diff --git a/test/benchmark/redis/ping_mbulk_100k_conc20_rps/config.json b/test/benchmark/redis/ping_mbulk_100k_conc20_rps/config.json new file mode 100644 index 000000000..70248dc0d --- /dev/null +++ b/test/benchmark/redis/ping_mbulk_100k_conc20_rps/config.json @@ -0,0 +1,9 @@ +{ + "alert_threshold": "125%", + "alert_tool": "customBiggerIsBetter", + "search_pattern": "throughput summary:", + "result_index": "3", + "description": "redis-benchmark -n 100000 -c 20 -t ping_mbulk", + "title": "Redis PING MBULK performance with 20 concurrency and 100000 requests in total", + "benchmark_type": "host_guest" +} \ No newline at end of file diff --git a/test/benchmark/redis/ping_mbulk_100k_conc20_rps/host.sh b/test/benchmark/redis/ping_mbulk_100k_conc20_rps/host.sh new file mode 100755 index 000000000..f881e4b85 --- /dev/null +++ b/test/benchmark/redis/ping_mbulk_100k_conc20_rps/host.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# SPDX-License-Identifier: MPL-2.0 + +set -e + +# Function to stop the guest VM +stop_guest() { + echo "Stopping guest VM..." + pgrep qemu | xargs kill +} + +# 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 + +# The trap will automatically stop the guest VM when the script exits \ No newline at end of file diff --git a/test/benchmark/redis/ping_mbulk_100k_conc20_rps/result_template.json b/test/benchmark/redis/ping_mbulk_100k_conc20_rps/result_template.json new file mode 100644 index 000000000..8b2597565 --- /dev/null +++ b/test/benchmark/redis/ping_mbulk_100k_conc20_rps/result_template.json @@ -0,0 +1,14 @@ +[ + { + "name": "Average RPS of PING_MBULK over virtio-net between Host Linux and Guest Linux", + "unit": "request per second", + "value": 0, + "extra": "linux_result" + }, + { + "name": "Average RPS of PING_MBULK over virtio-net between Host Linux and Guest Asterinas", + "unit": "request per second", + "value": 0, + "extra": "aster_result" + } +] \ No newline at end of file diff --git a/test/benchmark/redis/ping_mbulk_100k_conc20_rps/run.sh b/test/benchmark/redis/ping_mbulk_100k_conc20_rps/run.sh new file mode 100644 index 000000000..4cd15355d --- /dev/null +++ b/test/benchmark/redis/ping_mbulk_100k_conc20_rps/run.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# SPDX-License-Identifier: MPL-2.0 + +set -e + +echo "Running redis server" +/usr/local/redis/bin/redis-server /etc/redis.conf diff --git a/test/benchmark/redis/set_100k_conc20_rps/config.json b/test/benchmark/redis/set_100k_conc20_rps/config.json new file mode 100644 index 000000000..6f655682c --- /dev/null +++ b/test/benchmark/redis/set_100k_conc20_rps/config.json @@ -0,0 +1,9 @@ +{ + "alert_threshold": "125%", + "alert_tool": "customBiggerIsBetter", + "search_pattern": "throughput summary:", + "result_index": "3", + "description": "redis-benchmark -n 100000 -c 20 -t set", + "title": "Redis SET performance with 20 concurrency and 100000 requests in total", + "benchmark_type": "host_guest" +} \ No newline at end of file diff --git a/test/benchmark/redis/set_100k_conc20_rps/host.sh b/test/benchmark/redis/set_100k_conc20_rps/host.sh new file mode 100755 index 000000000..0a514de33 --- /dev/null +++ b/test/benchmark/redis/set_100k_conc20_rps/host.sh @@ -0,0 +1,19 @@ +#!/bin/sh + +# SPDX-License-Identifier: MPL-2.0 + +set -e + +# Function to stop the guest VM +stop_guest() { + echo "Stopping guest VM..." + pgrep qemu | xargs kill +} + +# 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 + +# The trap will automatically stop the guest VM when the script exits \ No newline at end of file diff --git a/test/benchmark/redis/set_100k_conc20_rps/result_template.json b/test/benchmark/redis/set_100k_conc20_rps/result_template.json new file mode 100644 index 000000000..e5c86f3ca --- /dev/null +++ b/test/benchmark/redis/set_100k_conc20_rps/result_template.json @@ -0,0 +1,14 @@ +[ + { + "name": "Average RPS of SET over virtio-net between Host Linux and Guest Linux", + "unit": "request per second", + "value": 0, + "extra": "linux_result" + }, + { + "name": "Average RPS of SET over virtio-net between Host Linux and Guest Asterinas", + "unit": "request per second", + "value": 0, + "extra": "aster_result" + } +] \ No newline at end of file diff --git a/test/benchmark/redis/set_100k_conc20_rps/run.sh b/test/benchmark/redis/set_100k_conc20_rps/run.sh new file mode 100644 index 000000000..4cd15355d --- /dev/null +++ b/test/benchmark/redis/set_100k_conc20_rps/run.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +# SPDX-License-Identifier: MPL-2.0 + +set -e + +echo "Running redis server" +/usr/local/redis/bin/redis-server /etc/redis.conf diff --git a/test/benchmark/redis/summary.json b/test/benchmark/redis/summary.json new file mode 100644 index 000000000..3f5ee4f46 --- /dev/null +++ b/test/benchmark/redis/summary.json @@ -0,0 +1,8 @@ +{ + "benchmarks": [ + "ping_inline_100k_conc20_rps", + "ping_mbulk_100k_conc20_rps", + "get_100k_conc20_rps", + "set_100k_conc20_rps" + ] +} \ No newline at end of file