-
Notifications
You must be signed in to change notification settings - Fork 0
257 lines (239 loc) · 8.57 KB
/
benchmarks.yaml
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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
on:
pull_request:
workflow_dispatch:
schedule:
# * is a special character in YAML so you have to quote this string
- cron: "0 */6 * * *"
jobs:
benchmark-self-hosted-arm64:
uses: ./.github/workflows/benchmark.yaml
with:
runs-on-hosted: self-hosted
runs-on-architecture: arm64
run-name: self-hosted-arm
benchmark-self-hosted-amd64:
uses: ./.github/workflows/benchmark.yaml
with:
runs-on-hosted: self-hosted
runs-on-architecture: amd64
run-name: self-hosted-amd
benchmark-github-hosted:
uses: ./.github/workflows/benchmark.yaml
with:
runs-on-hosted: ubuntu-latest
run-name: github-hosted
comparison:
runs-on: [self-hosted, amd64]
needs:
- benchmark-self-hosted-arm64
- benchmark-self-hosted-amd64
- benchmark-github-hosted
steps:
- uses: actions/download-artifact@v4
with:
name: self-hosted-amd-csv
path: results/v1/
- uses: actions/download-artifact@v4
with:
name: github-hosted-csv
path: results/v1/
- name: Create charts
if: ${{ always() && !cancelled() }}
run: |
sudo apt install -y python3-venv
python3 -m venv .venv
source .venv/bin/activate
pip install matplotlib pandas
echo '
import datetime
import pandas as pd
import pytz
from matplotlib import pyplot as plt
self_hosted_data = pd.read_csv("results/v1/self-hosted-amd.csv")
self_hosted_data["time"] = pd.to_datetime(self_hosted_data["time"])
self_hosted_data = self_hosted_data[
self_hosted_data.time
>= pd.to_datetime(
datetime.datetime.now().replace(tzinfo=pytz.UTC) - datetime.timedelta(days=7)
)
]
github_hosted_data = pd.read_csv("results/v1/github-hosted.csv")
github_hosted_data["time"] = pd.to_datetime(self_hosted_data["time"])
github_hosted_data = github_hosted_data[
github_hosted_data.time
>= pd.to_datetime(
datetime.datetime.now().replace(tzinfo=pytz.UTC) - datetime.timedelta(days=7)
)
]
ping_column_name = "network speed test ping (s)"
comparison_data = self_hosted_data
comparison_data[ping_column_name] = (
comparison_data[ping_column_name] - github_hosted_data[ping_column_name]
)
jitter_column_name = "jitter (s)"
comparison_data[jitter_column_name] = (
comparison_data[jitter_column_name] - github_hosted_data[jitter_column_name]
)
upload_column_name = "upload (bit/s)"
comparison_data[upload_column_name] = (
comparison_data[upload_column_name] - github_hosted_data[upload_column_name]
)
download_column_name = "download (bit/s)"
comparison_data[download_column_name] = (
comparison_data[download_column_name] - github_hosted_data[download_column_name]
)
ch_mean_download_column_name = "charmhub resource download mean (s)"
comparison_data[ch_mean_download_column_name] = (
comparison_data[ch_mean_download_column_name]
- github_hosted_data[ch_mean_download_column_name]
)
ch_min_download_column_name = "min (s)"
comparison_data[ch_min_download_column_name] = (
comparison_data[ch_min_download_column_name]
- github_hosted_data[ch_min_download_column_name]
)
ch_max_download_column_name = "max (s)"
comparison_data[ch_max_download_column_name] = (
comparison_data[ch_max_download_column_name]
- github_hosted_data[ch_max_download_column_name]
)
def get_color_low_better(data):
return ["r" if val > 0 else "g" for val in data]
def get_color_high_better(data):
return ["g" if val > 0 else "r" for val in data]
plt.subplot(2, 4, 1)
plt.scatter(
comparison_data["time"],
comparison_data[ping_column_name],
color=get_color_low_better(comparison_data[ping_column_name]),
)
plt.axhline(y=0)
plt.title("Network Speed Test Ping")
plt.xlabel("time")
plt.ylabel("milliseconds")
plt.xticks(rotation=30)
plt.subplot(2, 4, 2)
plt.scatter(
comparison_data["time"],
comparison_data[jitter_column_name],
color=get_color_low_better(comparison_data[jitter_column_name]),
)
plt.axhline(y=0)
plt.title("Jitter")
plt.xlabel("time")
plt.ylabel("milliseconds")
plt.xticks(rotation=30)
plt.subplot(2, 4, 3)
plt.scatter(
comparison_data["time"],
comparison_data[upload_column_name],
color=get_color_high_better(comparison_data[upload_column_name]),
)
plt.axhline(y=0)
plt.title("Upload (MBit/s)")
plt.xlabel("time")
plt.ylabel("milliseconds")
plt.xticks(rotation=30)
plt.subplot(2, 4, 4)
plt.scatter(
comparison_data["time"],
comparison_data[download_column_name],
color=get_color_high_better(comparison_data[download_column_name]),
)
plt.axhline(y=0)
plt.title("Download (MBit/s)")
plt.xlabel("time")
plt.ylabel("milliseconds")
plt.xticks(rotation=30)
plt.subplot(2, 3, 4)
plt.scatter(
comparison_data["time"],
comparison_data[ch_mean_download_column_name],
color=get_color_low_better(comparison_data[ch_mean_download_column_name]),
)
plt.axhline(y=0)
plt.title("Charmhub Resource Download Mean")
plt.xlabel("time")
plt.ylabel("seconds")
plt.xticks(rotation=30)
plt.subplot(2, 3, 5)
plt.scatter(
comparison_data["time"],
comparison_data[ch_min_download_column_name],
color=get_color_low_better(comparison_data[ch_min_download_column_name]),
)
plt.axhline(y=0)
plt.title("Charmhub Resource Download Min")
plt.xlabel("time")
plt.ylabel("seconds")
plt.xticks(rotation=30)
plt.subplot(2, 3, 6)
plt.scatter(
comparison_data["time"],
comparison_data[ch_max_download_column_name],
color=get_color_low_better(comparison_data[ch_max_download_column_name]),
)
plt.axhline(y=0)
plt.title("Charmhub Resource Download Max")
plt.xlabel("time")
plt.ylabel("seconds")
plt.xticks(rotation=30)
fig = plt.gcf()
fig.set_figwidth(1.5 * 16)
fig.set_figheight(1.5 * 9)
plt.savefig(f"results/v1/comparison.png")
' > create_chart.py
python create_chart.py
deactivate
rm -rf .venv
rm create_chart.py
- name: Upload png
uses: actions/upload-artifact@v4
with:
name: comparison-png
path: results/v1/comparison.png
publish:
runs-on: [self-hosted, amd64]
needs:
- benchmark-self-hosted-arm64
- benchmark-self-hosted-amd64
- benchmark-github-hosted
- comparison
steps:
- uses: actions/download-artifact@v4
with:
name: self-hosted-arm-csv
path: results/v1/
- uses: actions/download-artifact@v4
with:
name: self-hosted-arm-png
path: results/v1/
- uses: actions/download-artifact@v4
with:
name: self-hosted-amd-csv
path: results/v1/
- uses: actions/download-artifact@v4
with:
name: self-hosted-amd-png
path: results/v1/
- uses: actions/download-artifact@v4
with:
name: github-hosted-csv
path: results/v1/
- uses: actions/download-artifact@v4
with:
name: github-hosted-png
path: results/v1/
- uses: actions/download-artifact@v4
with:
name: comparison-png
path: results/v1/
- run: ls -la results/v1/
- name: Publish
if: ${{ always() && !cancelled() }}
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: .
keep_files: true
enable_jekyll: true