-
Notifications
You must be signed in to change notification settings - Fork 95
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #770 from containerd/load-test-http
feat: Add wasmtime http load test in the CI
- Loading branch information
Showing
7 changed files
with
168 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
name: "Run hey load test" | ||
description: "Composite action to run hey load test" | ||
|
||
inputs: | ||
github-token: | ||
description: "GitHub token" | ||
required: true | ||
|
||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Install hey | ||
shell: bash | ||
run: | | ||
curl -LO https://hey-release.s3.us-east-2.amazonaws.com/hey_linux_amd64 | ||
chmod +x hey_linux_amd64 | ||
sudo mv hey_linux_amd64 /usr/local/bin/hey | ||
hey --help | ||
- name: Run hey benchmark | ||
shell: bash | ||
run: | | ||
hey -n 100000 -c 50 http://127.0.0.1:8080 > raw-output.txt | ||
python3 ./scripts/parse-hey.py raw-output.txt > benchmark-results.json | ||
cat benchmark-results.json | ||
- name: Report Throughput results | ||
uses: benchmark-action/[email protected] | ||
with: | ||
name: "HTTP Throughput" | ||
tool: "customBiggerIsBetter" | ||
output-file-path: benchmark-results.json | ||
github-token: ${{ inputs.github-token }} | ||
external-data-json-path: ./cache/benchmark-data.json | ||
summary-always: true | ||
alert-threshold: "120%" | ||
fail-on-alert: true | ||
- name: Report Latency results | ||
uses: benchmark-action/[email protected] | ||
with: | ||
name: "HTTP Latency" | ||
tool: "customSmallerIsBetter" | ||
output-file-path: benchmark-results.json | ||
github-token: ${{ inputs.github-token }} | ||
external-data-json-path: ./cache/benchmark-data.json | ||
summary-always: true | ||
alert-threshold: "130%" | ||
fail-on-alert: true |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
# Usage: | ||
# | ||
# First run: hey http://127.0.0.1:8080 > raw-output.txt | ||
# Then run: python ./scripts/parse-hey.py ./raw-output.txt | ||
# Output: | ||
# [ | ||
# { | ||
# "name": "HTTP RPS", | ||
# "unit": "req/s", | ||
# "value": 13334.5075 | ||
# }, | ||
# { | ||
# "name": "HTTP p95 Latency", | ||
# "unit": "ms", | ||
# "value": 4.1000000000000005 | ||
# } | ||
# ] | ||
|
||
|
||
import json | ||
import re | ||
import sys | ||
|
||
def parse_hey_output(file_path): | ||
with open(file_path, 'r') as f: | ||
lines = f.readlines() | ||
|
||
rps = None | ||
lat = None | ||
|
||
for i, line in enumerate(lines): | ||
line = line.strip() | ||
|
||
if line.startswith("Requests/sec:"): | ||
parts = line.split() | ||
if len(parts) >= 2: | ||
rps = float(parts[1]) | ||
|
||
if "Latency distribution:" in line: | ||
for j in range(i+1, len(lines)): | ||
if "% in" in lines[j] and "95%" in lines[j]: | ||
match = re.search(r'95% in ([0-9.]+) secs', lines[j]) | ||
if match: | ||
lat = float(match.group(1)) | ||
break | ||
|
||
return rps, lat | ||
|
||
|
||
if __name__ == "__main__": | ||
if len(sys.argv) != 2: | ||
print("Usage: python parse_hey.py <hey-output-file>") | ||
sys.exit(1) | ||
|
||
file_path = sys.argv[1] | ||
rps, latency = parse_hey_output(file_path) | ||
|
||
latency = latency * 1000 if latency is not None else None | ||
|
||
results = [] | ||
if rps is not None: | ||
results.append({ | ||
"name": "HTTP RPS", | ||
"unit": "req/s", | ||
"value": rps | ||
}) | ||
|
||
if latency is not None: | ||
results.append({ | ||
"name": "HTTP p95 Latency", | ||
"unit": "ms", | ||
"value": latency | ||
}) | ||
|
||
print(json.dumps(results, indent=2)) |