From 84bcbf907db6a743198bdea7d671a53f17535bc9 Mon Sep 17 00:00:00 2001 From: Raul Sevilla Date: Wed, 19 Jul 2023 13:04:56 +0200 Subject: [PATCH] Ability to trigger multiple procs from the same client Signed-off-by: Raul Sevilla --- README.md | 1 + config/standard.yml | 4 ++++ pkg/config/config.go | 1 + pkg/config/types.go | 4 +++- pkg/runner/exec.go | 19 +++++++++++-------- pkg/runner/runner.go | 3 ++- 6 files changed, 22 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index d21ceeb..a63e0ab 100644 --- a/README.md +++ b/README.md @@ -22,6 +22,7 @@ Ingress-perf configuration is defined in a YAML file, holding an array of the fo | `delay` | `time.Duration` | Defines a delay between samples. | `0s` | | `warmup` | `bool` | Enables warmup: indexing will be disabled in this scenario. | `false` | | `requestTimeout` | `time.Duration` | Request timeout | `1s` | +| `procs ` | `int` | Number of processes to trigger in each of the client pods | `1` | ## Supported tools diff --git a/config/standard.yml b/config/standard.yml index 09d4310..08e22fc 100644 --- a/config/standard.yml +++ b/config/standard.yml @@ -22,6 +22,7 @@ tool: wrk serverReplicas: 90 delay: 10s + procs: 2 - termination: edge connections: 200 @@ -32,6 +33,7 @@ tool: wrk serverReplicas: 90 delay: 10s + procs: 2 - termination: reencrypt connections: 200 @@ -42,6 +44,7 @@ tool: wrk serverReplicas: 90 delay: 10s + procs: 2 - termination: passthrough connections: 200 @@ -52,6 +55,7 @@ tool: wrk serverReplicas: 90 delay: 10s + procs: 2 - termination: http connections: 200 diff --git a/pkg/config/config.go b/pkg/config/config.go index d8fd350..3ded5fa 100644 --- a/pkg/config/config.go +++ b/pkg/config/config.go @@ -27,6 +27,7 @@ func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error { defaultCfg := ConfigDefaulted{ Warmup: false, // Disable warmup by default RequestTimeout: time.Second, + Procs: 1, } if err := unmarshal(&defaultCfg); err != nil { return err diff --git a/pkg/config/types.go b/pkg/config/types.go index 623ee17..c0a5d9c 100644 --- a/pkg/config/types.go +++ b/pkg/config/types.go @@ -30,8 +30,10 @@ type Config struct { Duration time.Duration `yaml:"duration" json:"duration"` // Path scenario endpoint. i.e: 1024.html, 2048.html Path string `yaml:"path" json:"path"` - // Concurrency defined the number of clients + // Concurrency defines the number of clients Concurrency int32 `yaml:"concurrency" json:"concurrency"` + // Procs processes per client pod + Procs int `yaml:"procs" json:"procs"` // Tool defines the tool to run the benchmark scenario Tool string `yaml:"tool" json:"tool"` // ServerReplicas number of server (nginx) replicas backed by the routes. Example: wrk diff --git a/pkg/runner/exec.go b/pkg/runner/exec.go index 89e8615..f4795e7 100644 --- a/pkg/runner/exec.go +++ b/pkg/runner/exec.go @@ -79,8 +79,10 @@ func runBenchmark(cfg config.Config, clusterMetadata ocpmetadata.ClusterMetadata } log.Infof("Running sample %d/%d: %v", i, cfg.Samples, cfg.Duration) for _, pod := range clientPods { - wg.Add(1) - go exec(context.TODO(), &wg, tool, pod, &result) + for i := 0; i < cfg.Procs; i++ { + wg.Add(1) + go exec(context.TODO(), &wg, tool, pod, &result) + } } wg.Wait() genResultSummary(&result) @@ -162,10 +164,11 @@ func genResultSummary(result *tools.Result) { result.P95Latency += float64(pod.P95Latency) result.P99Latency += float64(pod.P99Latency) } - result.StdevRps = result.StdevRps / float64(len(result.Pods)) - result.AvgLatency = result.AvgLatency / float64(len(result.Pods)) - result.StdevLatency = result.StdevLatency / float64(len(result.Pods)) - result.P90Latency = result.P90Latency / float64(len(result.Pods)) - result.P95Latency = result.P95Latency / float64(len(result.Pods)) - result.P99Latency = result.P99Latency / float64(len(result.Pods)) + pods := float64(len(result.Pods)) + result.StdevRps = result.StdevRps / pods + result.AvgLatency = result.AvgLatency / pods + result.StdevLatency = result.StdevLatency / pods + result.P90Latency = result.P90Latency / pods + result.P95Latency = result.P95Latency / pods + result.P99Latency = result.P99Latency / pods } diff --git a/pkg/runner/runner.go b/pkg/runner/runner.go index f3eeccd..c8e5a97 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -85,11 +85,12 @@ func Start(uuid, baseUUID, baseIndex string, tolerancy int, indexer *indexers.In for i, cfg := range config.Cfg { cfg.UUID = uuid log.Infof("Running test %d/%d ", i+1, len(config.Cfg)) - log.Infof("Tool:%s termination:%v servers:%d concurrency:%d connections:%d duration:%v", + log.Infof("Tool:%s termination:%v servers:%d concurrency:%d procs:%d connections:%d duration:%v", cfg.Tool, cfg.Termination, cfg.ServerReplicas, cfg.Concurrency, + cfg.Procs, cfg.Connections, cfg.Duration, )