-
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
WIP: Benchmark tool #46
Closed
Closed
Changes from 16 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
efaa9a9
PoC
wallrj c90606b
Remove secret provisioning
wallrj 7ec8968
Configurable measurementInterval
wallrj e8caac4
Allow cleanup to be disabled
wallrj 517b0c2
Documentation
wallrj bddba79
Configurable cert-manager installation namespace
wallrj d515513
Configurable Certificate private key size
wallrj 4302a18
Experiment 2024-04-07-2
wallrj f2121df
Experiments 3,4,5
wallrj 4c0ee73
Remove original experiment data
wallrj a0795b6
Move experiment data
wallrj 67c1c9e
Add Excel files
wallrj b76daa2
Add experiment details
wallrj f7e1991
Document how I've been running the benchmark
wallrj 27db12e
Add copyright headers
wallrj a7e76cb
Add charts
wallrj 36bfa37
Various updates
wallrj c7a668c
Experiment 2024-04-09-1
wallrj a5e02d2
Configurable secret key algorithm
wallrj 5da7443
Configurable ramp-up load interval
wallrj f00777e
A script to run the benchmark based on parameters in environment vari…
wallrj 89219e1
Disable benchmark rate-limiter to create certificates as fast as poss…
wallrj 2491210
Allow shorter steady-state phase when using run.sh
wallrj 1d1d627
Get Secret Count and size in single operation and get the results in …
wallrj 0e2b447
Allow for more CerificateRequests than Certificates
wallrj 3a459ac
Configurable cleanup interval and cleanup in larger batches
wallrj 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
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
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,140 @@ | ||
/* | ||
Copyright 2021 The cert-manager 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 benchmark | ||
|
||
import ( | ||
"context" | ||
"time" | ||
|
||
"github.com/spf13/cobra" | ||
"k8s.io/cli-runtime/pkg/genericiooptions" | ||
|
||
"github.com/cert-manager/cmctl/v2/pkg/build" | ||
"github.com/cert-manager/cmctl/v2/pkg/factory" | ||
) | ||
|
||
const ( | ||
label = "benchmark.cmctl.cert-manager.io/experiment" | ||
) | ||
|
||
const description = ` | ||
This command runs a cert-manager benchmark which stress tests the cert-manager | ||
components and measures their CPU and memory. | ||
|
||
The default benchmark takes ~50 minutes with the default installation of cert-manager. | ||
There are five phases: | ||
|
||
1. ramp-up (~8 minutes) | ||
|
||
Creates 2000 self-signed RSA(4096) Certificate resources spread across 200 namespaces; | ||
1 self-signed Issuer per namespace. | ||
Certificates are created in batches: 1 namespace, 1 issuer, 10 Certificates. | ||
All the benchmark resources are labelled: 'benchmark.cmctl.cert-manager.io/experiment=true' | ||
so that they can easily be identified and deleted afterwards. | ||
|
||
2. catch-up (~26 minutes) | ||
|
||
Waits for cert-manager to reconcile all 2000 Certificates. | ||
|
||
3. steady-state (~10 minutes) | ||
|
||
Continues to measure the cert-manager CPU and memory consumption for 10 minutes. | ||
|
||
4. cleanup (~3 minutes) | ||
|
||
Deletes all 2000 Certificates and other benchmark resources. | ||
The benchmark namespaces are deleted in batches of 10 per second. | ||
|
||
5. final-measurements (~2 minutes) | ||
|
||
Continues to measure the cert-manager CPU and memory consumption for 2 minutes. | ||
|
||
Example: | ||
kind create cluster | ||
|
||
# Install metrics-server which is required for measuring cert-manager resource usage | ||
helm upgrade metrics-server metrics-server \ | ||
--repo https://kubernetes-sigs.github.io/metrics-server/ \ | ||
--install \ | ||
--namespace kube-system \ | ||
--set args={--kubelet-insecure-tls} | ||
|
||
# Install cert-manager | ||
{{.BuildName}} x install | ||
|
||
{{.BuildName}} x benchmark > data.json | ||
` | ||
|
||
type options struct { | ||
genericiooptions.IOStreams | ||
*factory.Factory | ||
|
||
measurementInterval time.Duration | ||
certManagerNamepsace string | ||
|
||
rampUpCertificateSize int | ||
rampUpTargetCertificateCount int64 | ||
steadyStateDuration time.Duration | ||
cleanupDisabled bool | ||
finalMeasurementsDuration time.Duration | ||
} | ||
|
||
func NewCmd(ctx context.Context, ioStreams genericiooptions.IOStreams) *cobra.Command { | ||
options := options{ | ||
IOStreams: ioStreams, | ||
} | ||
|
||
cmd := &cobra.Command{ | ||
Use: "benchmark", | ||
Short: "benchmark cert-manager", | ||
Long: build.WithTemplate(description), | ||
RunE: func(cmd *cobra.Command, args []string) error { | ||
e := experiment{ | ||
options: options, | ||
measurements: newMeasurements(options), | ||
} | ||
if err := e.run(cmd.Context()); err != nil { | ||
return err | ||
} | ||
return nil | ||
}, | ||
} | ||
|
||
cmd.Flags().DurationVar(&options.measurementInterval, "benchmark.measurement-interval", time.Second*10, | ||
"The interval between measurements.") | ||
|
||
cmd.Flags().StringVar(&options.certManagerNamepsace, "benchmark.cert-manager-namespace", "cert-manager", | ||
"The namespace where cert-manager is installed.") | ||
|
||
cmd.Flags().IntVar(&options.rampUpCertificateSize, "benchmark.phase1.certificate-size", 4096, | ||
"The private key size of Certificate resources created during the ramp-up phase.") | ||
|
||
cmd.Flags().Int64Var(&options.rampUpTargetCertificateCount, "benchmark.phase1.target-certificate-count", 2000, | ||
"The number of Certificate resources to create during the ramp-up phase.") | ||
|
||
cmd.Flags().DurationVar(&options.steadyStateDuration, "benchmark.phase3.duration", time.Minute*10, | ||
"The duration of the steady-state phase.") | ||
|
||
cmd.Flags().BoolVar(&options.cleanupDisabled, "benchmark.phase4.disabled", false, | ||
"Disable the cleanup phase.") | ||
|
||
cmd.Flags().DurationVar(&options.finalMeasurementsDuration, "benchmark.phase5.duration", time.Minute*2, | ||
"The duration of the final-measurements phase.") | ||
|
||
options.Factory = factory.New(cmd) | ||
return cmd | ||
} |
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.