From ad08c0898604b4072280fdfd032693c4e49902c5 Mon Sep 17 00:00:00 2001 From: Petu Eusebiu Date: Thu, 21 Apr 2022 16:56:21 +0300 Subject: [PATCH] cluster: use zb source ips pool to distribute requests to cluster Signed-off-by: Petu Eusebiu --- .github/workflows/cluster.yaml | 26 +++++++++++++-- cmd/zb/perf.go | 61 ++++++++++++++++++++++++++-------- 2 files changed, 70 insertions(+), 17 deletions(-) diff --git a/.github/workflows/cluster.yaml b/.github/workflows/cluster.yaml index 42243ab5..ed5d815f 100644 --- a/.github/workflows/cluster.yaml +++ b/.github/workflows/cluster.yaml @@ -136,15 +136,35 @@ jobs: AWS_ACCESS_KEY_ID: minioadmin AWS_SECRET_ACCESS_KEY: minioadmin - - name: Run benchmark + - name: Run benchmark with --src-cidr arg run: | make bench ./bin/zot-linux-amd64 serve test/cluster/config-minio1.json & ./bin/zot-linux-amd64 serve test/cluster/config-minio2.json & ./bin/zot-linux-amd64 serve test/cluster/config-minio3.json & sleep 10 - # run zb - bin/zb-linux-amd64 -c 10 -n 50 -o ci-cd http://localhost:8080 + # run zb with --src-cidr + bin/zb-linux-amd64 -c 10 -n 50 -o ci-cd --src-cidr 127.0.0.0/8 http://localhost:8080 + + killall -r zot-* + + # clean zot storage + sudo rm -rf /tmp/data/zot-storage/zot + env: + AWS_ACCESS_KEY_ID: minioadmin + AWS_SECRET_ACCESS_KEY: minioadmin + + - name: Run benchmark with --src-ips arg + run: | + make bench + ./bin/zot-linux-amd64 serve test/cluster/config-minio1.json & + ./bin/zot-linux-amd64 serve test/cluster/config-minio2.json & + ./bin/zot-linux-amd64 serve test/cluster/config-minio3.json & + sleep 10 + # run zb with --src-ips + bin/zb-linux-amd64 -c 10 -n 50 -o ci-cd --src-ips 127.0.0.2,127.0.0.3,127.0.0.4,127.0.0.5,127.0.0.6,127.0.12.5,127.0.12.6 http://localhost:8080 + + killall -r zot-* env: AWS_ACCESS_KEY_ID: minioadmin AWS_SECRET_ACCESS_KEY: minioadmin diff --git a/cmd/zb/perf.go b/cmd/zb/perf.go index 41998f20..d1649690 100644 --- a/cmd/zb/perf.go +++ b/cmd/zb/perf.go @@ -289,11 +289,21 @@ func normalizeProbabilityRange(pbty []float64) []float64 { // test suites/funcs. -type testFunc func(workdir, url, repo string, requests int, config testConfig, - statsCh chan statsRecord, client *resty.Client) error +type testFunc func( + workdir, url, repo string, + requests int, + config testConfig, + statsCh chan statsRecord, + client *resty.Client, +) error -func GetCatalog(workdir, url, repo string, requests int, config testConfig, - statsCh chan statsRecord, client *resty.Client) error { +func GetCatalog( + workdir, url, repo string, + requests int, + config testConfig, + statsCh chan statsRecord, + client *resty.Client, +) error { for count := 0; count < requests; count++ { func() { start := time.Now() @@ -338,8 +348,13 @@ func GetCatalog(workdir, url, repo string, requests int, config testConfig, return nil } -func PushMonolithStreamed(workdir, url, trepo string, requests int, config testConfig, - statsCh chan statsRecord, client *resty.Client) error { +func PushMonolithStreamed( + workdir, url, trepo string, + requests int, + config testConfig, + statsCh chan statsRecord, + client *resty.Client, +) error { var repos []string if config.mixedSize { @@ -360,8 +375,13 @@ func PushMonolithStreamed(workdir, url, trepo string, requests int, config testC return nil } -func PushChunkStreamed(workdir, url, trepo string, requests int, config testConfig, - statsCh chan statsRecord, client *resty.Client) error { +func PushChunkStreamed( + workdir, url, trepo string, + requests int, + config testConfig, + statsCh chan statsRecord, + client *resty.Client, +) error { var repos []string if config.mixedSize { @@ -382,8 +402,13 @@ func PushChunkStreamed(workdir, url, trepo string, requests int, config testConf return nil } -func Pull(workdir, url, trepo string, requests int, - config testConfig, statsCh chan statsRecord, client *resty.Client) error { +func Pull( + workdir, url, trepo string, + requests int, + config testConfig, + statsCh chan statsRecord, + client *resty.Client, +) error { var repos []string var manifestHash map[string]string @@ -453,8 +478,13 @@ func Pull(workdir, url, trepo string, requests int, return nil } -func MixedPullAndPush(workdir, url, trepo string, requests int, - config testConfig, statsCh chan statsRecord, client *resty.Client) error { +func MixedPullAndPush( + workdir, url, trepo string, + requests int, + config testConfig, + statsCh chan statsRecord, + client *resty.Client, +) error { var repos []string statusRequests = make(map[string]int) @@ -595,8 +625,11 @@ var testSuite = []testConfig{ // nolint:gochecknoglobals // used only in this te }, } -func Perf(workdir, url, auth, repo string, concurrency int, requests int, outFmt string, - srcIPs string, srcCIDR string) { +func Perf( + workdir, url, auth, repo string, + concurrency int, requests int, + outFmt string, srcIPs string, srcCIDR string, +) { json := jsoniter.ConfigCompatibleWithStandardLibrary // logging log.SetFlags(0)