-
Notifications
You must be signed in to change notification settings - Fork 8
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrating vegeta #44
Open
rsevilla87
wants to merge
6
commits into
cloud-bulldozer:main
Choose a base branch
from
rsevilla87:vegeta
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0406dde
Vegeta support
rsevilla87 f1e73cd
Typo
rsevilla87 e9cd122
Missing license
rsevilla87 7f70196
Not write results in disk, use max-body=0
rsevilla87 94b9667
Bumping to 12.11.1
rsevilla87 9bb84c1
Fix concurrent map writes panic
rsevilla87 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# vi: expandtab shiftwidth=2 softtabstop=2 | ||
|
||
# First scenario is configured as warmup and it will also tune the default ingress-controller to assign the router pods to the infra nodes | ||
- termination: http | ||
connections: 400 | ||
samples: 5 | ||
duration: 2m | ||
path: /256.html | ||
concurrency: 9 | ||
tool: vegeta | ||
serverReplicas: 45 | ||
tuningPatch: '{"spec":{"nodePlacement": {"nodeSelector": {"matchLabels": {"node-role.kubernetes.io/infra": ""}}}, "replicas": 2}}' | ||
delay: 10s | ||
threads: 400 | ||
requestTimeout: 10s | ||
warmup: true | ||
|
||
- termination: reencrypt | ||
connections: 400 | ||
samples: 2 | ||
duration: 2m | ||
path: /256.html | ||
concurrency: 9 | ||
tool: vegeta | ||
serverReplicas: 45 | ||
threads: 400 | ||
requestTimeout: 10s | ||
delay: 10s | ||
|
||
- termination: http | ||
connections: 400 | ||
samples: 2 | ||
duration: 2m | ||
path: /256.html | ||
concurrency: 9 | ||
tool: vegeta | ||
serverReplicas: 45 | ||
threads: 400 | ||
requestTimeout: 10s | ||
delay: 10s | ||
|
||
- termination: edge | ||
connections: 400 | ||
samples: 2 | ||
duration: 2m | ||
path: /256.html | ||
concurrency: 9 | ||
tool: vegeta | ||
serverReplicas: 45 | ||
threads: 400 | ||
requestTimeout: 10s | ||
delay: 10s | ||
|
||
- termination: passthrough | ||
connections: 400 | ||
samples: 2 | ||
duration: 2m | ||
path: /256.html | ||
concurrency: 9 | ||
tool: vegeta | ||
serverReplicas: 45 | ||
threads: 400 | ||
requestTimeout: 10s | ||
delay: 10s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
// Copyright 2023 The ingress-perf Authors | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package tools | ||
|
||
import ( | ||
"encoding/json" | ||
"fmt" | ||
|
||
"github.com/cloud-bulldozer/ingress-perf/pkg/config" | ||
) | ||
|
||
type vegeta struct { | ||
cmd []string | ||
res VegetaResult | ||
} | ||
|
||
func init() { | ||
toolMap["vegeta"] = Vegeta | ||
} | ||
|
||
func Vegeta(cfg config.Config, ep string) Tool { | ||
endpoint := fmt.Sprintf("echo GET %v", ep) | ||
vegetaCmd := fmt.Sprintf("vegeta attack -insecure -max-connections=%d -duration=%v -timeout=%v -keepalive=%v -max-body=0", | ||
cfg.Connections, | ||
cfg.Duration, | ||
cfg.RequestTimeout, | ||
cfg.Keepalive, | ||
) | ||
if cfg.RequestRate > 0 { | ||
vegetaCmd += fmt.Sprintf(" -rate=%d", cfg.RequestRate) | ||
} else { | ||
vegetaCmd += fmt.Sprintf(" -rate=0 -workers=%d -max-workers=%d", cfg.Threads, cfg.Threads) | ||
} | ||
|
||
newWrk := &vegeta{ | ||
cmd: []string{"bash", "-c", fmt.Sprintf("%v | %v | vegeta report -type json", endpoint, vegetaCmd)}, | ||
res: VegetaResult{}, | ||
} | ||
return newWrk | ||
} | ||
|
||
func (v *vegeta) Cmd() []string { | ||
return v.cmd | ||
} | ||
|
||
/* Example JSON output | ||
{ | ||
"latencies": { | ||
"total": 1256079085, | ||
"mean": 31401977, | ||
"50th": 24082627, | ||
"90th": 56335116, | ||
"95th": 66540881, | ||
"99th": 77088475, | ||
"max": 77088475, | ||
"min": 16256151 | ||
}, | ||
"bytes_in": { | ||
"total": 29211360, | ||
"mean": 730284 | ||
}, | ||
"bytes_out": { | ||
"total": 0, | ||
"mean": 0 | ||
}, | ||
"earliest": "2023-09-28T12:04:38.399615001+02:00", | ||
"latest": "2023-09-28T12:04:42.300039403+02:00", | ||
"end": "2023-09-28T12:04:42.364625089+02:00", | ||
"duration": 3900424402, | ||
"wait": 64585686, | ||
"requests": 40, | ||
"rate": 10.255294264770113, | ||
"throughput": 10.088246716208607, | ||
"success": 1, | ||
"status_codes": { | ||
"200": 40 | ||
}, | ||
"errors": [] | ||
} | ||
*/ | ||
|
||
func (v *vegeta) ParseResult(stdout, _ string) (PodResult, error) { | ||
var podResult PodResult | ||
err := json.Unmarshal([]byte(stdout), &v.res) | ||
if err != nil { | ||
return podResult, err | ||
} | ||
podResult = PodResult{ | ||
AvgRps: v.res.Throughput, | ||
AvgLatency: v.res.Latencies.AvgLatency / 1e3, | ||
MaxLatency: v.res.Latencies.MaxLatency / 1e3, | ||
P90Latency: int64(v.res.Latencies.P90Latency / 1e3), | ||
P95Latency: int64(v.res.Latencies.P95Latency / 1e3), | ||
P99Latency: int64(v.res.Latencies.P99Latency / 1e3), | ||
Requests: v.res.Requests, | ||
StatusCodes: v.res.StatusCodes, | ||
} | ||
return podResult, nil | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Multi-arch container might break here, as we are always pulling
linux-amd64
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the looks of is vegeta is available for amd64/arm64 and not for other archs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, added a note about the supported archs. Only amd64 for now, we can work to integrate others in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ack, I missed the README.md.
I do not want us to publish/ship multi-architecture images with a linux_amd64 binary,
can we please update this?
https://github.com/cloud-bulldozer/ingress-perf/blob/main/Makefile#L38