diff --git a/.github/workflows/benchmark_asterinas.yml b/.github/workflows/benchmark_asterinas.yml index 83366dc5..02dba5d4 100644 --- a/.github/workflows/benchmark_asterinas.yml +++ b/.github/workflows/benchmark_asterinas.yml @@ -64,7 +64,9 @@ jobs: - lmbench/tcp_loopback_http_bw - lmbench/udp_loopback_lat - iperf3/tcp_virtio_bw + # Nginx benchmarks - nginx/http_req10k_conc1_bw + - nginx/http_req10k_conc20_bw # Redis benchmarks - redis/ping_inline_100k_conc20_rps - redis/ping_mbulk_100k_conc20_rps diff --git a/test/benchmark/nginx/http_req10k_conc20_bw/config.json b/test/benchmark/nginx/http_req10k_conc20_bw/config.json new file mode 100644 index 00000000..859ba21d --- /dev/null +++ b/test/benchmark/nginx/http_req10k_conc20_bw/config.json @@ -0,0 +1,9 @@ +{ + "alert_threshold": "125%", + "alert_tool": "customBiggerIsBetter", + "search_pattern": "Transfer rate:", + "result_index": "3", + "description": "ab -n 10000 -c 20 http://localhost:8080/index.html", + "title": "Nginx HTTP request performance with 20 concurrency and 10000 requests in total", + "benchmark_type": "host_guest" +} \ No newline at end of file diff --git a/test/benchmark/nginx/http_req10k_conc20_bw/host.sh b/test/benchmark/nginx/http_req10k_conc20_bw/host.sh new file mode 100755 index 00000000..309b247b --- /dev/null +++ b/test/benchmark/nginx/http_req10k_conc20_bw/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 +ab -n 10000 -c 20 http://localhost:8080/index.html + +# The trap will automatically stop the guest VM when the script exits \ No newline at end of file diff --git a/test/benchmark/nginx/http_req10k_conc20_bw/result_template.json b/test/benchmark/nginx/http_req10k_conc20_bw/result_template.json new file mode 100644 index 00000000..a7af3b94 --- /dev/null +++ b/test/benchmark/nginx/http_req10k_conc20_bw/result_template.json @@ -0,0 +1,14 @@ +[ + { + "name": "Average HTTP Bandwidth over virtio-net between Host Linux and Guest Linux", + "unit": "Kbytes/sec", + "value": 0, + "extra": "linux_result" + }, + { + "name": "Average HTTP Bandwidth over virtio-net between Host Linux and Guest Asterinas", + "unit": "Kbytes/sec", + "value": 0, + "extra": "aster_result" + } +] \ No newline at end of file diff --git a/test/benchmark/nginx/http_req10k_conc20_bw/run.sh b/test/benchmark/nginx/http_req10k_conc20_bw/run.sh new file mode 100644 index 00000000..cd714623 --- /dev/null +++ b/test/benchmark/nginx/http_req10k_conc20_bw/run.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +# SPDX-License-Identifier: MPL-2.0 + +set -e + +cp /benchmark/nginx/nginx.conf /usr/local/nginx/conf/ + +echo "Running nginx server" +/usr/local/nginx/sbin/nginx diff --git a/test/benchmark/nginx/summary.json b/test/benchmark/nginx/summary.json index d456125e..e4017e0d 100644 --- a/test/benchmark/nginx/summary.json +++ b/test/benchmark/nginx/summary.json @@ -1,5 +1,6 @@ { "benchmarks": [ - "http_req10k_conc1_bw" + "http_req10k_conc1_bw", + "http_req10k_conc20_bw" ] } \ No newline at end of file