-
Notifications
You must be signed in to change notification settings - Fork 99
164 lines (153 loc) · 6.6 KB
/
benchmarks.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
name: Run Benchmarks
on:
schedule:
- cron: '0 0 * * *' # Runs daily at midnight
pull_request:
permissions:
# deployments permission to deploy GitHub pages website
deployments: write
# contents permission to update benchmark contents in gh-pages branch
contents: write
jobs:
benchmark:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: '' #Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile
- uses: ./.github/actions/setup-env
- uses: ./.github/actions/build
- name: Run Benchmarks
shell: bash
run: |
set -o pipefail
cargo bench -p containerd-shim-benchmarks -- --output-format bencher | tee output.txt
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1.20.4
with:
name: Criterion.rs Benchmark
tool: 'cargo'
output-file-path: output.txt
github-token: ${{ secrets.GITHUB_TOKEN }}
# my experimental local benchmarking seems to have a 20% margin of error.
# So I set the alert threshold to 130% of the previous benchmark result.
# If the current benchmark result is more than 130% of the previous benchmark result, it will fail.
alert-threshold: '130%'
fail-on-alert: ${{ github.event_name == 'schedule' }}
alert-comment-cc-users: '@runwasi-committers'
# Enable Job Summary
summary-always: true
# Automatically push the benchmark result to gh-pages branch
# See https://github.com/benchmark-action/github-action-benchmark?tab=readme-ov-file#charts-on-github-pages-1 for more details
auto-push: ${{ github.event_name == 'schedule' }}
benchmark-mem:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: '' #Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile
- uses: ./.github/actions/setup-env
- uses: ./.github/actions/build
- name: Run Benchmarks
shell: bash
run: |
set -euxo pipefail
for RUNTIME in wasmtime wasmedge wasmer wamr; do
sudo ./scripts/benchmark-mem.sh $RUNTIME > bench-mem-$RUNTIME.json
done
cat bench-mem-* | jq -s 'flatten(1)' > bench-mem.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1.20.4
with:
name: Criterion.rs Benchmark
tool: 'customSmallerIsBetter'
output-file-path: bench-mem.json
github-token: ${{ secrets.GITHUB_TOKEN }}
# my experimental local benchmarking seems to have a 20% margin of error.
# So I set the alert threshold to 130% of the previous benchmark result.
# If the current benchmark result is more than 130% of the previous benchmark result, it will fail.
alert-threshold: '130%'
fail-on-alert: ${{ github.event_name == 'schedule' }}
alert-comment-cc-users: '@runwasi-committers'
# Enable Job Summary
summary-always: true
# Automatically push the benchmark result to gh-pages branch
# See https://github.com/benchmark-action/github-action-benchmark?tab=readme-ov-file#charts-on-github-pages-1 for more details
auto-push: ${{ github.event_name == 'schedule' }}
benchmark-http:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: '' #Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile
- uses: ./.github/actions/setup-env
- uses: ./.github/actions/build
- name: Start wasmtime shim
shell: bash
run: |
sudo ctr run --rm --net-host --runtime=io.containerd.wasmtime.v1 ghcr.io/containerd/runwasi/wasi-demo-http:latest wasi-http /wasi-http.wasm &
sleep 1
- name: Wait for wasmtime shim to start
shell: bash
run: |
while ! curl -s http://127.0.0.1:8080 > /dev/null; do
sleep 1
done
timeout-minutes: 5
- name: Run HTTP throughput and latency benchmarks
if: success()
uses: ./.github/actions/run-hey-load-test
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Stop wasmtime shim
if: success()
shell: bash
run: |
sudo ctr task kill -s SIGKILL wasi-http
benchmark-stress:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
rustflags: '' #Disable. By default this action sets environment variable is set to -D warnings. We manage this in the Makefile
- uses: ./.github/actions/setup-env
- name: Setup build profile
shell: bash
run: |
echo "OPT_PROFILE=release" >> ${GITHUB_ENV}
echo "STRESS_TEST_COUNT=1000" >> ${GITHUB_ENV}
echo "STRESS_TEST_TIMEOUT=10s" >> ${GITHUB_ENV}
- uses: ./.github/actions/build
- name: Run Stress Tests
shell: bash
run: |
set -euxo pipefail
for RUNTIME in wasmtime wasmedge wasmer wamr; do
# Run containerd stress tests with different images
for IMAGE_TYPE in app oci; do
make test/stress-c8d-$RUNTIME \
STRESS_TEST_JSON=stress-bench-c8d-${IMAGE_TYPE}-${RUNTIME}.json \
STRESS_TEST_IMAGE=ghcr.io/containerd/runwasi/wasi-demo-${IMAGE_TYPE}:latest
done
# Run non-containerd stress test
make test/stress-$RUNTIME \
STRESS_TEST_JSON=stress-bench-${RUNTIME}.json \
STRESS_TEST_IMAGE=ghcr.io/containerd/runwasi/wasi-demo-app:latest
done
cat stress-bench-*.json | jq -s 'flatten(1)' > stress-bench.json
- name: Store benchmark result
uses: benchmark-action/github-action-benchmark@v1.20.4
with:
name: Stress Test Benchmark
tool: 'customBiggerIsBetter'
output-file-path: stress-bench.json
github-token: ${{ secrets.GITHUB_TOKEN }}
alert-threshold: '130%'
fail-on-alert: ${{ github.event_name == 'schedule' }}
alert-comment-cc-users: '@runwasi-committers'
summary-always: true
auto-push: ${{ github.event_name == 'schedule' }}