0
Fork 0
mirror of https://github.com/project-zot/zot.git synced 2024-12-30 22:34:13 -05:00

cluster: use zb source ips pool to distribute requests to cluster

Signed-off-by: Petu Eusebiu <peusebiu@cisco.com>
This commit is contained in:
Petu Eusebiu 2022-04-21 16:56:21 +03:00 committed by Ramkumar Chinchani
parent ca8b866c46
commit ad08c08986
2 changed files with 70 additions and 17 deletions

View file

@ -136,15 +136,35 @@ jobs:
AWS_ACCESS_KEY_ID: minioadmin AWS_ACCESS_KEY_ID: minioadmin
AWS_SECRET_ACCESS_KEY: minioadmin AWS_SECRET_ACCESS_KEY: minioadmin
- name: Run benchmark - name: Run benchmark with --src-cidr arg
run: | run: |
make bench make bench
./bin/zot-linux-amd64 serve test/cluster/config-minio1.json & ./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-minio2.json &
./bin/zot-linux-amd64 serve test/cluster/config-minio3.json & ./bin/zot-linux-amd64 serve test/cluster/config-minio3.json &
sleep 10 sleep 10
# run zb # run zb with --src-cidr
bin/zb-linux-amd64 -c 10 -n 50 -o ci-cd http://localhost:8080 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: env:
AWS_ACCESS_KEY_ID: minioadmin AWS_ACCESS_KEY_ID: minioadmin
AWS_SECRET_ACCESS_KEY: minioadmin AWS_SECRET_ACCESS_KEY: minioadmin

View file

@ -289,11 +289,21 @@ func normalizeProbabilityRange(pbty []float64) []float64 {
// test suites/funcs. // test suites/funcs.
type testFunc func(workdir, url, repo string, requests int, config testConfig, type testFunc func(
statsCh chan statsRecord, client *resty.Client) error 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, func GetCatalog(
statsCh chan statsRecord, client *resty.Client) error { workdir, url, repo string,
requests int,
config testConfig,
statsCh chan statsRecord,
client *resty.Client,
) error {
for count := 0; count < requests; count++ { for count := 0; count < requests; count++ {
func() { func() {
start := time.Now() start := time.Now()
@ -338,8 +348,13 @@ func GetCatalog(workdir, url, repo string, requests int, config testConfig,
return nil return nil
} }
func PushMonolithStreamed(workdir, url, trepo string, requests int, config testConfig, func PushMonolithStreamed(
statsCh chan statsRecord, client *resty.Client) error { workdir, url, trepo string,
requests int,
config testConfig,
statsCh chan statsRecord,
client *resty.Client,
) error {
var repos []string var repos []string
if config.mixedSize { if config.mixedSize {
@ -360,8 +375,13 @@ func PushMonolithStreamed(workdir, url, trepo string, requests int, config testC
return nil return nil
} }
func PushChunkStreamed(workdir, url, trepo string, requests int, config testConfig, func PushChunkStreamed(
statsCh chan statsRecord, client *resty.Client) error { workdir, url, trepo string,
requests int,
config testConfig,
statsCh chan statsRecord,
client *resty.Client,
) error {
var repos []string var repos []string
if config.mixedSize { if config.mixedSize {
@ -382,8 +402,13 @@ func PushChunkStreamed(workdir, url, trepo string, requests int, config testConf
return nil return nil
} }
func Pull(workdir, url, trepo string, requests int, func Pull(
config testConfig, statsCh chan statsRecord, client *resty.Client) error { workdir, url, trepo string,
requests int,
config testConfig,
statsCh chan statsRecord,
client *resty.Client,
) error {
var repos []string var repos []string
var manifestHash map[string]string var manifestHash map[string]string
@ -453,8 +478,13 @@ func Pull(workdir, url, trepo string, requests int,
return nil return nil
} }
func MixedPullAndPush(workdir, url, trepo string, requests int, func MixedPullAndPush(
config testConfig, statsCh chan statsRecord, client *resty.Client) error { workdir, url, trepo string,
requests int,
config testConfig,
statsCh chan statsRecord,
client *resty.Client,
) error {
var repos []string var repos []string
statusRequests = make(map[string]int) 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, func Perf(
srcIPs string, srcCIDR string) { workdir, url, auth, repo string,
concurrency int, requests int,
outFmt string, srcIPs string, srcCIDR string,
) {
json := jsoniter.ConfigCompatibleWithStandardLibrary json := jsoniter.ConfigCompatibleWithStandardLibrary
// logging // logging
log.SetFlags(0) log.SetFlags(0)