From 72abab49478abad0f6cb899355bb372b4441af62 Mon Sep 17 00:00:00 2001 From: Ramkumar Chinchani <45800463+rchincha@users.noreply.github.com> Date: Tue, 29 Nov 2022 14:04:36 -0800 Subject: [PATCH] perf(zb): cleanup tool output (#1033) Signed-off-by: Ramkumar Chinchani --- README.md | 46 +------------------------------------- cmd/zb/README.md | 58 ++++++++++++++++++++++++++++++++++++++++++++---- cmd/zb/perf.go | 26 +++++++++++++++++----- 3 files changed, 75 insertions(+), 55 deletions(-) diff --git a/README.md b/README.md index b7f27bb4..f619909d 100644 --- a/README.md +++ b/README.md @@ -309,54 +309,10 @@ will produce `bin/zb` binary. ## Running `zb` -```console -$ zb -c 10 -n 1000 http://localhost:8080 - -Registry URL: http://localhost:8080 - -Concurrency Level: 2 -Total requests: 100 -Working dir: - -============ -Test name: Get Catalog -Time taken for tests: 45.397205ms -Complete requests: 100 -Failed requests: 0 -Requests per second: 2202.7788 - -2xx responses: 100 - -min: 402.259µs -max: 3.295887ms -p50: 855.045µs -p75: 971.709µs -p90: 1.127389ms -p99: 3.295887ms - -============ -Test name: Push Monolith 1MB -Time taken for tests: 952.336383ms -Complete requests: 100 -Failed requests: 0 -Requests per second: 105.00491 - -2xx responses: 100 - -min: 11.125673ms -max: 26.375356ms -p50: 18.917253ms -p75: 21.753441ms -p90: 24.02137ms -p99: 26.375356ms - -... -``` - +See [details](./cmd/zb/README.md) # Ecosystem - ## skopeo [skopeo](https://github.com/containers/skopeo) is a tool to work with remote diff --git a/cmd/zb/README.md b/cmd/zb/README.md index ef96813a..15ab788e 100644 --- a/cmd/zb/README.md +++ b/cmd/zb/README.md @@ -20,10 +20,60 @@ Flags: -d, --working-dir string Use specified directory to store test data ``` - ## Command example - ``` - ./bin/zb-linux-amd64 -c 10 -n 100 --src-cidr 127.0.0.0/8 -A user:pass http://localhost:8080 - ``` +## Command example +``` +./bin/zb-linux-amd64 -c 10 -n 100 --src-cidr 127.0.0.0/8 -A user:pass http://localhost:8080 +``` + +``` +docker run -net=host -it ghcr.io/project-zot/zb-linux-amd64:latest -c 2 -n 10 -s 127.0.0.0/8 http://localhost:5000 +``` + +## Command output + +```console +$ zb -c 10 -n 1000 http://localhost:8080 + +Registry URL: http://localhost:8080 + +Concurrency Level: 2 +Total requests: 100 +Working dir: + +============ +Test name: Get Catalog +Time taken for tests: 45.397205ms +Complete requests: 100 +Failed requests: 0 +Requests per second: 2202.7788 + +2xx responses: 100 + +min: 402.259µs +max: 3.295887ms +p50: 855.045µs +p75: 971.709µs +p90: 1.127389ms +p99: 3.295887ms + +============ +Test name: Push Monolith 1MB +Time taken for tests: 952.336383ms +Complete requests: 100 +Failed requests: 0 +Requests per second: 105.00491 + +2xx responses: 100 + +min: 11.125673ms +max: 26.375356ms +p50: 18.917253ms +p75: 21.753441ms +p90: 24.02137ms +p99: 26.375356ms + +... +``` # References diff --git a/cmd/zb/perf.go b/cmd/zb/perf.go index e62ac0c1..4fbf6c8e 100644 --- a/cmd/zb/perf.go +++ b/cmd/zb/perf.go @@ -640,21 +640,35 @@ func Perf( log.SetFlags(0) log.SetOutput(tabwriter.NewWriter(os.Stdout, 0, 0, 1, ' ', tabwriter.TabIndent)) - // initialize test data - setup(workdir) - defer teardown(workdir) - // common header log.Printf("Registry URL:\t%s", url) log.Printf("\n") log.Printf("Concurrency Level:\t%v", concurrency) log.Printf("Total requests:\t%v", requests) - log.Printf("Working dir:\t%v", workdir) + + if workdir == "" { + cwd, err := os.Getwd() + if err != nil { + log.Fatal("unable to get current working dir") + } + + log.Printf("Working dir:\t%v", cwd) + } else { + log.Printf("Working dir:\t%v", workdir) + } + log.Printf("\n") - zbError := false + // initialize test data + log.Printf("Preparing test data ...\n") + + setup(workdir) + defer teardown(workdir) + + log.Printf("Starting tests ...\n") var err error + zbError := false // get host ips from command line to make requests from var ips []string