-
Notifications
You must be signed in to change notification settings - Fork 97
143 lines (135 loc) · 5.68 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
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
# pull requests permission to comment on PRs
pull-requests: 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
- name: Setup build environment
shell: bash
run: |
os=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]')
./scripts/setup-$os.sh
- name: Build and load shims and wasi-demo-app
shell: bash
run: |
make OPT_PROFILE=release build install test-image load test-image/oci load/oci
- 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/[email protected]
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' }}
# Enable comment to the PR
comment-always: ${{ 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
- name: Setup build environment
shell: bash
run: |
os=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]')
./scripts/setup-$os.sh
- name: Build and load shims and wasi-demo-app
shell: bash
run: |
make OPT_PROFILE=release build install test-image load test-image/oci load/oci
- 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/[email protected]
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' }}
# Enable comment to the PR
comment-always: ${{ 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
- name: Setup build environment
shell: bash
run: |
os=$(echo "$RUNNER_OS" | tr '[:upper:]' '[:lower:]')
./scripts/setup-$os.sh
- name: Build and load shims and wasi-demo-app
shell: bash
run: |
make OPT_PROFILE=release build install test-image/http load/http
- name: Start wasmtime shim
shell: bash
run: |
sudo ctr run --rm --net-host --runtime=io.containerd.wasmtime.v1 ghcr.io/containerd/runwasi/wasi-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
- 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