From 510d4edb3efd8773329166d85e625fdea100d388 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Sevilla?= Date: Mon, 24 Jul 2023 11:56:00 +0200 Subject: [PATCH] Ability to trigger multiple processes from the same client (#21) * Ability to trigger multiple procs from the same client Signed-off-by: Raul Sevilla * Bump QPS/Burst Signed-off-by: Raul Sevilla --------- 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 | 7 ++++--- 6 files changed, 24 insertions(+), 12 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 35acc3f..3c42ac7 100644 --- a/pkg/runner/exec.go +++ b/pkg/runner/exec.go @@ -80,8 +80,10 @@ func runBenchmark(cfg config.Config, clusterMetadata ocpmetadata.ClusterMetadata result.Config.Tuning = currentTuning // It's usefult to index the current tunning configuration in the all benchmark's documents 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) @@ -163,10 +165,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 fcf934f..19a725e 100644 --- a/pkg/runner/runner.go +++ b/pkg/runner/runner.go @@ -64,8 +64,8 @@ func Start(uuid, baseUUID, baseIndex string, tolerancy int, indexer *indexers.In if err != nil { return err } - restConfig.QPS = 50 - restConfig.Burst = 50 + restConfig.QPS = 200 + restConfig.Burst = 200 clientSet = kubernetes.NewForConfigOrDie(restConfig) orClientSet = openshiftrouteclientset.NewForConfigOrDie(restConfig) dynamicClient = dynamic.NewForConfigOrDie(restConfig) @@ -86,11 +86,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, )