Skip to content

Commit 97b65b5

Browse files
authored
feat(zb): Support for TTFB measurement + on-demand sync tests (#3929)
feat(zb): support for measuring TTFB + sync tests Adds supports for measuring time to first byte (TTFB) for Pull tests for the manifest check, the manifest get, the config get, and the blob get. Additionally, this introduces 2 new sync tests which measure the performance of on-demand sync. Setup code has been refactored to accomodate a new blob size of 1GB. Parts of zb have been refactored to address linter errors. Signed-off-by: Vishwas Rajashekar <dev@vrajashkr.com>
1 parent 9ba5955 commit 97b65b5

4 files changed

Lines changed: 531 additions & 179 deletions

File tree

cmd/zb/README.md

Lines changed: 193 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,20 @@ Usage:
88
zb <url> [flags]
99
1010
Flags:
11-
-A, --auth-creds string Use colon-separated BASIC auth creds
12-
-c, --concurrency int Number of multiple requests to make at a time (default 1)
13-
-h, --help help for zb
14-
-l, --list-tests Print a list of all available tests. When used together with test regex, lists the tests that match the regex.
15-
-o, --output-format string Output format of test results: stdout (default), json, ci-cd
16-
-r, --repo string Use specified repo on remote registry for test data
17-
-n, --requests int Number of requests to perform (default 1)
18-
--skip-cleanup Skip clean up of pushed repos from remote registry after running benchmark (default false)
19-
-s, --src-cidr string Use specified cidr to obtain ips to make requests from, src-ips and src-cidr are mutually exclusive
20-
-i, --src-ips string Use colon-separated ips to make requests from, src-ips and src-cidr are mutually exclusive
21-
-t, --test-regex string Optional regex for selectively running tests. If blank, all tests are run by default.
22-
-v, --version Show the version and exit
23-
-d, --working-dir string Use specified directory to store test data
11+
-A, --auth-creds string Use colon-separated BASIC auth creds
12+
-c, --concurrency int Number of multiple requests to make at a time (default 1)
13+
-h, --help help for zb
14+
-l, --list-tests Print a list of all available tests. When used together with test regex, lists the tests that match the regex.
15+
-o, --output-format string Output format of test results: stdout (default), json, ci-cd
16+
-r, --repo string Use specified repo on remote registry for test data
17+
-n, --requests int Number of requests to perform (default 1)
18+
--skip-cleanup Skip clean up of pushed repos from remote registry after running benchmark (default false)
19+
-s, --src-cidr string Use specified cidr to obtain ips to make requests from, src-ips and src-cidr are mutually exclusive
20+
-i, --src-ips string Use colon-separated ips to make requests from, src-ips and src-cidr are mutually exclusive
21+
-t, --test-regex string Optional regex for selectively running tests. If blank, all tests are run by default.
22+
-u, --upstream-server-url string Sets the upstream server URL for sync tests. Must be provided for sync tests.
23+
-v, --version Show the version and exit
24+
-d, --working-dir string Use specified directory to store test data
2425
```
2526

2627
## Command example
@@ -35,14 +36,16 @@ docker run -net=host -it ghcr.io/project-zot/zb-linux-amd64:latest -c 2 -n 10 -s
3536
## Command output
3637

3738
```console
38-
$ zb -c 10 -n 1000 http://localhost:8080
39-
40-
Registry URL: http://localhost:8080
41-
39+
$ zb -c 2 -n 100 http://localhost:8080
40+
Registry URL: http://localhost:8080
4241
Concurrency Level: 2
4342
Total requests: 100
44-
Working dir:
43+
Working dir: /home/user/test
4544

45+
Skipping test On-demand Sync 100MB
46+
Skipping test On-demand Sync 1GB
47+
Preparing test data ...
48+
Starting tests ...
4649
============
4750
Test name: Get Catalog
4851
Time taken for tests: 45.397205ms
@@ -98,6 +101,8 @@ Push Chunk Mixed 33% 1MB, 33% 10MB, 33% 100MB
98101
Pull 75% and Push 25% Mixed 1MB
99102
Pull 75% and Push 25% Mixed 10MB
100103
Pull 75% and Push 25% Mixed 100MB
104+
On-demand Sync 100MB
105+
On-demand Sync 1GB
101106
```
102107

103108
## List tests with Regex
@@ -112,31 +117,12 @@ Pull 1MB
112117

113118
```
114119
$ zb --src-cidr 127.0.0.0/8 --test-regex "^Push Monolith 1MB$" http://localhost:9000
115-
Registry URL: http://localhost:9000
116-
120+
Registry URL: http://localhost:9000
117121
Concurrency Level: 1
118122
Total requests: 1
119-
Working dir: /home/darkaether/projects/github/zot
123+
Working dir: /home/user/test
120124
121-
Preparing test data ...
122-
Starting tests ...
123125
Skipping test Get Catalog
124-
============
125-
Test name: Push Monolith 1MB
126-
Time taken for tests: 18.700779ms
127-
Requests per second: 53.47371
128-
Complete requests: 1
129-
Failed requests: 0
130-
131-
2xx responses: 1
132-
133-
min: 15.970773ms
134-
max: 15.970773ms
135-
p50: 15.970773ms
136-
p75: 15.970773ms
137-
p90: 15.970773ms
138-
p99: 15.970773ms
139-
140126
Skipping test Push Monolith 10MB
141127
Skipping test Push Monolith 100MB
142128
Skipping test Push Chunk Streamed 1MB
@@ -151,58 +137,128 @@ Skipping test Push Chunk Mixed 33% 1MB, 33% 10MB, 33% 100MB
151137
Skipping test Pull 75% and Push 25% Mixed 1MB
152138
Skipping test Pull 75% and Push 25% Mixed 10MB
153139
Skipping test Pull 75% and Push 25% Mixed 100MB
140+
Skipping test On-demand Sync 100MB
141+
Skipping test On-demand Sync 1GB
142+
Preparing test data ...
143+
Starting tests ...
144+
============
145+
Test name: Push Monolith 1MB
146+
Time taken for tests: 20.821408ms
147+
Requests per second: 48.027493
148+
Complete requests: 1
149+
Failed requests: 0
150+
151+
2xx responses: 1
152+
153+
min: 18.527633ms
154+
max: 18.527633ms
155+
p50: 18.527633ms
156+
p75: 18.527633ms
157+
p90: 18.527633ms
158+
p99: 18.527633ms
154159
```
155160

156161
## Selective test run with a push and corresponding pull
157162

158163
```
159164
$ zb --src-cidr 127.0.0.0/8 --test-regex "^(Push Monolith|Pull) 1MB$" http://localhost:9000
160-
Registry URL: http://localhost:9000
161-
165+
Registry URL: http://localhost:9000
162166
Concurrency Level: 1
163167
Total requests: 1
164-
Working dir: /home/darkaether/projects/github/zot
168+
Working dir: /home/user/test
165169
170+
Skipping test Get Catalog
171+
Skipping test Push Monolith 10MB
172+
Skipping test Push Monolith 100MB
173+
Skipping test Push Chunk Streamed 1MB
174+
Skipping test Push Chunk Streamed 10MB
175+
Skipping test Push Chunk Streamed 100MB
176+
Skipping test Pull 10MB
177+
Skipping test Pull 100MB
178+
Skipping test Pull Mixed 20% 1MB, 70% 10MB, 10% 100MB
179+
Skipping test Push Monolith Mixed 20% 1MB, 70% 10MB, 10% 100MB
180+
Skipping test Push Chunk Mixed 33% 1MB, 33% 10MB, 33% 100MB
181+
Skipping test Pull 75% and Push 25% Mixed 1MB
182+
Skipping test Pull 75% and Push 25% Mixed 10MB
183+
Skipping test Pull 75% and Push 25% Mixed 100MB
184+
Skipping test On-demand Sync 100MB
185+
Skipping test On-demand Sync 1GB
166186
Preparing test data ...
167187
Starting tests ...
168-
Skipping test Get Catalog
169188
============
170189
Test name: Push Monolith 1MB
171-
Time taken for tests: 19.136523ms
172-
Requests per second: 52.256096
190+
Time taken for tests: 21.497313ms
191+
Requests per second: 46.51744
173192
Complete requests: 1
174193
Failed requests: 0
175194
176195
2xx responses: 1
177196
178-
min: 16.496555ms
179-
max: 16.496555ms
180-
p50: 16.496555ms
181-
p75: 16.496555ms
182-
p90: 16.496555ms
183-
p99: 16.496555ms
197+
min: 18.826599ms
198+
max: 18.826599ms
199+
p50: 18.826599ms
200+
p75: 18.826599ms
201+
p90: 18.826599ms
202+
p99: 18.826599ms
184203
185-
Skipping test Push Monolith 10MB
186-
Skipping test Push Monolith 100MB
187-
Skipping test Push Chunk Streamed 1MB
188-
Skipping test Push Chunk Streamed 10MB
189-
Skipping test Push Chunk Streamed 100MB
190204
============
191205
Test name: Pull 1MB
192-
Time taken for tests: 17.836719ms
193-
Requests per second: 56.06412
206+
Time taken for tests: 15.387887ms
207+
Requests per second: 64.98618
194208
Complete requests: 1
195209
Failed requests: 0
196210
197211
2xx responses: 1
198212
199-
min: 3.774833ms
200-
max: 3.774833ms
201-
p50: 3.774833ms
202-
p75: 3.774833ms
203-
p90: 3.774833ms
204-
p99: 3.774833ms
213+
min: 2.343145ms
214+
max: 2.343145ms
215+
p50: 2.343145ms
216+
p75: 2.343145ms
217+
p90: 2.343145ms
218+
p99: 2.343145ms
219+
220+
Manifest HEAD TTFB p50: 352.099µs
221+
Manifest HEAD TTFB p75: 352.099µs
222+
Manifest HEAD TTFB p90: 352.099µs
223+
Manifest HEAD TTFB p99: 352.099µs
224+
225+
Manifest GET TTFB p50: 323.77µs
226+
Manifest GET TTFB p75: 323.77µs
227+
Manifest GET TTFB p90: 323.77µs
228+
Manifest GET TTFB p99: 323.77µs
229+
230+
Config TTFB p50: 318.809µs
231+
Config TTFB p75: 318.809µs
232+
Config TTFB p90: 318.809µs
233+
Config TTFB p99: 318.809µs
234+
235+
Layer TTFB p50: 219.679µs
236+
Layer TTFB p75: 219.679µs
237+
Layer TTFB p90: 219.679µs
238+
Layer TTFB p99: 219.679µs
239+
```
240+
241+
## Run on-demand sync tests
242+
243+
Sync tests require an upstream zot registry to be provided and the target zot instance must be configured with on-demand sync config that points to the upstream server.
244+
If upstream registry is not provided, sync tests will be skipped.
245+
246+
```
247+
$ zb --src-cidr 127.0.0.0/8 --test-regex "^On-demand Sync" --upstream-server-url http://localhost:9000 http://localhost:8080
248+
Registry URL: http://localhost:8080
249+
Upstream Registry URL: http://localhost:9000
250+
Concurrency Level: 1
251+
Total requests: 1
252+
Working dir: /home/user/test
205253
254+
Skipping test Get Catalog
255+
Skipping test Push Monolith 1MB
256+
Skipping test Push Monolith 10MB
257+
Skipping test Push Monolith 100MB
258+
Skipping test Push Chunk Streamed 1MB
259+
Skipping test Push Chunk Streamed 10MB
260+
Skipping test Push Chunk Streamed 100MB
261+
Skipping test Pull 1MB
206262
Skipping test Pull 10MB
207263
Skipping test Pull 100MB
208264
Skipping test Pull Mixed 20% 1MB, 70% 10MB, 10% 100MB
@@ -211,6 +267,79 @@ Skipping test Push Chunk Mixed 33% 1MB, 33% 10MB, 33% 100MB
211267
Skipping test Pull 75% and Push 25% Mixed 1MB
212268
Skipping test Pull 75% and Push 25% Mixed 10MB
213269
Skipping test Pull 75% and Push 25% Mixed 100MB
270+
Preparing test data ...
271+
Starting tests ...
272+
============
273+
Test name: On-demand Sync 100MB
274+
Time taken for tests: 1.444024183s
275+
Requests per second: 0.6925092
276+
Complete requests: 1
277+
Failed requests: 0
278+
279+
2xx responses: 1
280+
281+
min: 550.943262ms
282+
max: 550.943262ms
283+
p50: 550.943262ms
284+
p75: 550.943262ms
285+
p90: 550.943262ms
286+
p99: 550.943262ms
287+
288+
Manifest HEAD TTFB p50: 546.921878ms
289+
Manifest HEAD TTFB p75: 546.921878ms
290+
Manifest HEAD TTFB p90: 546.921878ms
291+
Manifest HEAD TTFB p99: 546.921878ms
292+
293+
Manifest GET TTFB p50: 1.988577ms
294+
Manifest GET TTFB p75: 1.988577ms
295+
Manifest GET TTFB p90: 1.988577ms
296+
Manifest GET TTFB p99: 1.988577ms
297+
298+
Config TTFB p50: 387.699µs
299+
Config TTFB p75: 387.699µs
300+
Config TTFB p90: 387.699µs
301+
Config TTFB p99: 387.699µs
302+
303+
Layer TTFB p50: 232.091µs
304+
Layer TTFB p75: 232.091µs
305+
Layer TTFB p90: 232.091µs
306+
Layer TTFB p99: 232.091µs
307+
308+
============
309+
Test name: On-demand Sync 1GB
310+
Time taken for tests: 16.783082396s
311+
Requests per second: 0.05958381
312+
Complete requests: 1
313+
Failed requests: 0
314+
315+
2xx responses: 1
316+
317+
min: 5.175110487s
318+
max: 5.175110487s
319+
p50: 5.175110487s
320+
p75: 5.175110487s
321+
p90: 5.175110487s
322+
p99: 5.175110487s
323+
324+
Manifest HEAD TTFB p50: 5.170570733s
325+
Manifest HEAD TTFB p75: 5.170570733s
326+
Manifest HEAD TTFB p90: 5.170570733s
327+
Manifest HEAD TTFB p99: 5.170570733s
328+
329+
Manifest GET TTFB p50: 2.269987ms
330+
Manifest GET TTFB p75: 2.269987ms
331+
Manifest GET TTFB p90: 2.269987ms
332+
Manifest GET TTFB p99: 2.269987ms
333+
334+
Config TTFB p50: 623.639µs
335+
Config TTFB p75: 623.639µs
336+
Config TTFB p90: 623.639µs
337+
Config TTFB p99: 623.639µs
338+
339+
Layer TTFB p50: 439.369µs
340+
Layer TTFB p75: 439.369µs
341+
Layer TTFB p90: 439.369µs
342+
Layer TTFB p99: 439.369µs
214343
```
215344

216345
# References

0 commit comments

Comments
 (0)