Skip to content

Commit

Permalink
Performance linters
Browse files Browse the repository at this point in the history
Signed-off-by: Raul Sevilla <[email protected]>
  • Loading branch information
rsevilla87 committed Oct 25, 2023
1 parent 0c78c6e commit 6b1fdc4
Show file tree
Hide file tree
Showing 6 changed files with 59 additions and 64 deletions.
3 changes: 3 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@ linters:
- gosimple
- unconvert
- gocyclo
- perfsprint
- bodyclose
- prealloc
100 changes: 44 additions & 56 deletions config/standard.yml
Original file line number Diff line number Diff line change
@@ -1,100 +1,88 @@
# vim: expandtab shiftwidth=2 softtabstop=2

# First sample is set as warmup and also will tune the default ingress-controller to place the routers on infra nodes
- termination: http
connections: 20
samples: 1
duration: 1m
path: /1024.html
concurrency: 1
tool: wrk
serverReplicas: 90
requestTimeout: 2s
tuningPatch: '{"spec":{"nodePlacement": {"nodeSelector": {"matchLabels": {"node-role.kubernetes.io/infra": ""}}}, "replicas": 2}}'
warmup: true

- termination: http
connections: 200
samples: 2
duration: 2m
duration: 10s
path: /1024.html
concurrency: 1
tool: wrk
serverReplicas: 90
delay: 10s
procs: 2
concurrency: 3
tool: hloader
serverReplicas: 30
delay: 5s
procs: 1

- termination: edge
connections: 200
samples: 2
duration: 2m
duration: 10s
path: /1024.html
concurrency: 1
tool: wrk
serverReplicas: 90
delay: 10s
procs: 2
concurrency: 4
tool: hloader
serverReplicas: 30
delay: 30s
procs: 1

- termination: reencrypt
connections: 200
samples: 2
duration: 2m
duration: 30s
path: /1024.html
concurrency: 1
tool: wrk
serverReplicas: 90
delay: 10s
procs: 2
concurrency: 3
tool: hloader
serverReplicas: 30
delay: 30s
procs: 1

- termination: passthrough
connections: 200
samples: 2
duration: 2m
duration: 30s
path: /1024.html
concurrency: 1
tool: wrk
serverReplicas: 90
delay: 10s
procs: 2
concurrency: 3
tool: hloader
serverReplicas: 30
delay: 30s
procs: 1

- termination: http
connections: 200
samples: 2
duration: 2m
duration: 30s
path: /1024.html
concurrency: 20
tool: wrk
serverReplicas: 90
delay: 10s
concurrency: 3
tool: hloader
serverReplicas: 30
delay: 30s

- termination: edge
connections: 200
samples: 2
duration: 2m
duration: 30s
path: /1024.html
concurrency: 20
tool: wrk
serverReplicas: 90
delay: 10s
concurrency: 3
tool: hloader
serverReplicas: 30
delay: 30s

- termination: reencrypt
connections: 200
samples: 2
duration: 2m
duration: 30s
path: /1024.html
concurrency: 20
tool: wrk
serverReplicas: 90
delay: 10s
concurrency: 3
tool: hloader
serverReplicas: 30
delay: 30s

- termination: passthrough
connections: 200
samples: 2
duration: 2m
duration: 30s
path: /1024.html
concurrency: 20
tool: wrk
serverReplicas: 90
delay: 10s
concurrency: 3
tool: hloader
serverReplicas: 30
delay: 30s


1 change: 1 addition & 0 deletions containers/Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ FROM registry.access.redhat.com/ubi8/ubi:latest
RUN dnf install -y iproute procps-ng
COPY --from=builder /wrk/wrk /usr/bin/wrk
COPY json.lua json.lua
COPY hloader /usr/bin/hloader
6 changes: 3 additions & 3 deletions pkg/runner/exec.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ func genResultSummary(result *tools.Result) {
if pod.MaxLatency > result.MaxLatency {
result.MaxLatency = pod.MaxLatency
}
result.P90Latency += float64(pod.P90Latency)
result.P95Latency += float64(pod.P95Latency)
result.P99Latency += float64(pod.P99Latency)
result.P90Latency += pod.P90Latency
result.P95Latency += pod.P95Latency
result.P99Latency += pod.P99Latency
}
pods := float64(len(result.Pods))
result.StdevRps = result.StdevRps / pods
Expand Down
10 changes: 6 additions & 4 deletions pkg/runner/tools/hloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package tools
import (
"encoding/json"
"fmt"
"strconv"

"github.com/cloud-bulldozer/ingress-perf/pkg/config"
)
Expand All @@ -31,14 +32,15 @@ func init() {
}

func HLoader(cfg config.Config, ep string) Tool {

newHLoader := &hLoader{
cmd: []string{"hloader", "-u", ep,
"-c", fmt.Sprint(cfg.Connections),
"-c", strconv.Itoa(cfg.Connections),
"-d", fmt.Sprint(cfg.Duration),
"-r", fmt.Sprint(cfg.RequestRate),
"-r", strconv.Itoa(cfg.RequestRate),
"-t", fmt.Sprint(cfg.RequestTimeout),
"-k", fmt.Sprint(cfg.Keepalive),
"--http2", fmt.Sprint(cfg.HTTP2),
"-k", strconv.FormatBool(cfg.Keepalive),
"--http2", strconv.FormatBool(cfg.HTTP2),
},
res: PodResult{},
}
Expand Down
3 changes: 2 additions & 1 deletion pkg/runner/tools/wrk.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package tools
import (
"encoding/json"
"fmt"
"strconv"

"github.com/cloud-bulldozer/ingress-perf/pkg/config"
)
Expand All @@ -32,7 +33,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", fmt.Sprintf("%v", cfg.RequestTimeout.Seconds())},
cmd: []string{"wrk", "-s", "json.lua", "-c", strconv.Itoa(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 6b1fdc4

Please sign in to comment.