From 61f6c637d27ce7cd655916c6419c379709cf8cf7 Mon Sep 17 00:00:00 2001 From: Yuke Peng Date: Sat, 28 Sep 2024 19:07:31 +0800 Subject: [PATCH] Add Nginx benchmark CI --- .github/workflows/benchmark_asterinas.yml | 1 + .../nginx/http_req10k_conc1_bw/config.json | 9 +++++++++ .../nginx/http_req10k_conc1_bw/host.sh | 19 +++++++++++++++++++ .../http_req10k_conc1_bw/result_template.json | 14 ++++++++++++++ .../nginx/http_req10k_conc1_bw/run.sh | 10 ++++++++++ test/benchmark/nginx/nginx.conf | 19 +++++++++++++++++++ test/benchmark/nginx/summary.json | 5 +++++ 7 files changed, 77 insertions(+) create mode 100644 test/benchmark/nginx/http_req10k_conc1_bw/config.json create mode 100755 test/benchmark/nginx/http_req10k_conc1_bw/host.sh create mode 100644 test/benchmark/nginx/http_req10k_conc1_bw/result_template.json create mode 100644 test/benchmark/nginx/http_req10k_conc1_bw/run.sh create mode 100644 test/benchmark/nginx/nginx.conf create mode 100644 test/benchmark/nginx/summary.json diff --git a/.github/workflows/benchmark_asterinas.yml b/.github/workflows/benchmark_asterinas.yml index 8c6d40c5..ed7b19a9 100644 --- a/.github/workflows/benchmark_asterinas.yml +++ b/.github/workflows/benchmark_asterinas.yml @@ -63,6 +63,7 @@ jobs: - lmbench/tcp_loopback_http_bw - lmbench/udp_loopback_lat - iperf3/tcp_virtio_bw + - nginx/http_req10k_conc1_bw fail-fast: false timeout-minutes: 60 container: diff --git a/test/benchmark/nginx/http_req10k_conc1_bw/config.json b/test/benchmark/nginx/http_req10k_conc1_bw/config.json new file mode 100644 index 00000000..82bb3274 --- /dev/null +++ b/test/benchmark/nginx/http_req10k_conc1_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 1 http://localhost:8080/index.html", + "title": "Nginx HTTP request performance with 1 concurrency and 10000 requests in total", + "benchmark_type": "host_guest" +} \ No newline at end of file diff --git a/test/benchmark/nginx/http_req10k_conc1_bw/host.sh b/test/benchmark/nginx/http_req10k_conc1_bw/host.sh new file mode 100755 index 00000000..b7998446 --- /dev/null +++ b/test/benchmark/nginx/http_req10k_conc1_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 1 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_conc1_bw/result_template.json b/test/benchmark/nginx/http_req10k_conc1_bw/result_template.json new file mode 100644 index 00000000..a7af3b94 --- /dev/null +++ b/test/benchmark/nginx/http_req10k_conc1_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_conc1_bw/run.sh b/test/benchmark/nginx/http_req10k_conc1_bw/run.sh new file mode 100644 index 00000000..cd714623 --- /dev/null +++ b/test/benchmark/nginx/http_req10k_conc1_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/nginx.conf b/test/benchmark/nginx/nginx.conf new file mode 100644 index 00000000..d370edb2 --- /dev/null +++ b/test/benchmark/nginx/nginx.conf @@ -0,0 +1,19 @@ +user root; +daemon off; +worker_processes 1; + +events { +} + +http { + include mime.types; + + server { + listen 10.0.2.15:8080; + access_log off; + + location / { + autoindex on; + } + } +} \ No newline at end of file diff --git a/test/benchmark/nginx/summary.json b/test/benchmark/nginx/summary.json new file mode 100644 index 00000000..d456125e --- /dev/null +++ b/test/benchmark/nginx/summary.json @@ -0,0 +1,5 @@ +{ + "benchmarks": [ + "http_req10k_conc1_bw" + ] +} \ No newline at end of file