Skip to content

Commit

Permalink
Custom request timeout
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 committed Jul 12, 2023
1 parent 6d6e7ef commit b374867
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 13 deletions.
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,18 @@ Ingress-perf configuration is defined in a YAML file, holding an array of the fo

| Field Name | Type | Description | Default Value |
|------------------|------------------|----------------------------------------------------------------------------------------------------------|---------------|
| `Termination` | `string` | Defines the type of benchmark termination. Allowed values are `http`, `edge`, `reencrypt` and `reencrypt`. | N/A |
| `Connections` | `int` | Defines the number of connections per client. | `0` |
| `Samples` | `int` | Defines the number of samples per scenario. | `0` |
| `Duration` | `time.Duration` | Defines the duration of each sample. | `""` |
| `Path` | `string` | Defines the scenario endpoint path, for example: `/1024.html`, `/2048.html`. | `""` |
| `Concurrency` | `int32` | Defines the number of clients that will concurrently run the benchmark scenario. | `0` |
| `Tool` | `string` | Defines the tool to run the benchmark scenario. | `""` |
| `ServerReplicas` | `int32` | Defines the number of server (nginx) replicas backed by the routes. | `0` |
| `Tuning` | `string` | Defines a tuning patch for the default `IngressController` object. | `""` |
| `Delay` | `time.Duration` | Defines a delay between samples. | `0s` |
| `Warmup` | `bool` | Enables warmup: indexing will be disabled in this scenario. The default value is `false`. | `false` |
| `termination` | `string` | Defines the type of benchmark termination. Allowed values are `http`, `edge`, `reencrypt` and `reencrypt`. | N/A |
| `connections` | `int` | Defines the number of connections per client. | `0` |
| `samples` | `int` | Defines the number of samples per scenario. | `0` |
| `duration` | `time.Duration` | Defines the duration of each sample. | `""` |
| `path` | `string` | Defines the scenario endpoint path, for example: `/1024.html`, `/2048.html`. | `""` |
| `concurrency` | `int32` | Defines the number of clients that will concurrently run the benchmark scenario. | `0` |
| `tool` | `string` | Defines the tool to run the benchmark scenario. | `""` |
| `serverReplicas` | `int32` | Defines the number of server (nginx) replicas backed by the routes. | `0` |
| `tuningPatch` | `string` | Defines a JSON merge tuning patch for the default `IngressController` object. | `""` |
| `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` |

## Supported tools

Expand Down
1 change: 1 addition & 0 deletions config/standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
concurrency: 1
tool: wrk
serverReplicas: 90
requestTimeout: 2s
tuningPatch: '{"spec":{"nodePlacement": {"nodeSelector": {"matchLabels": {"node-role.kubernetes.io/infra": ""}}}, "replicas": 2}}'
warmup: true

Expand Down
4 changes: 3 additions & 1 deletion pkg/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package config

import (
"os"
"time"

yaml "gopkg.in/yaml.v3"
)
Expand All @@ -24,7 +25,8 @@ import (
func (c *Config) UnmarshalYAML(unmarshal func(interface{}) error) error {
type ConfigDefaulted Config
defaultCfg := ConfigDefaulted{
Warmup: false, // Disable warmup by default
Warmup: false, // Disable warmup by default
RequestTimeout: time.Second,
}
if err := unmarshal(&defaultCfg); err != nil {
return err
Expand Down
2 changes: 2 additions & 0 deletions pkg/config/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ type Config struct {
Delay time.Duration `yaml:"delay"`
// Warmup enables warmup: Indexing will be disabled in this scenario. Default is false
Warmup bool `yaml:"warmup" json:"-"`
// RequestTimeout defines the tool request timeout
RequestTimeout time.Duration `yaml:"requestTimeout"`
}
2 changes: 1 addition & 1 deletion pkg/runner/tools/wrk.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ func init() {

func Wrk(cfg config.Config, ep string) Tool {
newWrk := &wrk{
cmd: []string{"wrk", "-s", "json.lua", "-c", fmt.Sprint(cfg.Connections), "-d", fmt.Sprintf("%v", cfg.Duration.Seconds()), "--latency", ep, "--timeout=1s"},
cmd: []string{"wrk", "-s", "json.lua", "-c", fmt.Sprint(cfg.Connections), "-d", fmt.Sprintf("%v", cfg.Duration.Seconds()), "--latency", ep, "--timeout", fmt.Sprintf("%v", cfg.RequestTimeout.Seconds())},
res: PodResult{},
}
return newWrk
Expand Down

0 comments on commit b374867

Please sign in to comment.