-
Notifications
You must be signed in to change notification settings - Fork 2k
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
main_test.go: Introduce overarching benchmark test #513
Conversation
main_test.go
Outdated
func injectFixtures(client *fake.Clientset) error { | ||
creators := []func(*fake.Clientset, int) error{ | ||
configMap, | ||
pod, |
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.
Happy to add more fixtures here, but would prefer general feedback first to prevent lost work.
This looks fantastic, and although the Pod and ConfigMap objects used for the test are not particularly representative of real world data they produce pretty much exactly the same profiles as production data does. Once the release phase is over I'm happy with merging this. /lgtm |
/hold |
main_test.go
Outdated
} | ||
|
||
for _, c := range creators { | ||
for i := 0; i < 1000; i++ { |
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.
It is a meaningful job, may it be better to make the number of tests configurable?
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.
I introduced multiplier
to injectFixtures
. Let me know what you think. This test will be further adjusted along side the future performance adjustments. This patch only lays down the skeleton to ensure we can backport the same test case to older versions to compare performance improvements.
This patch adds a simple go benchmark test, injecting Kubernetes objects and simulating scrape requests. It uses the Kubernetes client-go fake client. Alongside comes some refactoring of each collectors structure using informer factories to be compatible with the fake client. The patch lays the groundwork to make future performance optimizations comparable with past versions. How to run test: `go test -race -bench . -memprofile=mem.out -cpuprofile=cpu.out`
Maybe we need to add a e2e_perf_test Makefile target to add more detailed e2e performance test. |
@andyxning would you mind elaborating further here? For me this is not an end-to-end test. It does not actually put kube-state-metrics in a production-like environment. I think in the long run we should have |
/hold cancel |
The v1.4.0 release is out and therefore feature freeze has been lifted. Let's move forward with this. /lgtm |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: brancz, mxinden The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
What this PR does / why we need it:
This patch adds a simple go benchmark test, injecting Kubernetes objects
and simulating scrape requests. It uses the Kubernetes client-go fake
client. Alongside comes some refactoring of each collectors structure
using informer factories to be compatible with the fake client.
The patch lays the groundwork to make future performance optimizations
comparable with past versions.
How to run test:
go test -race -bench . -memprofile=mem.out -cpuprofile=cpu.out
Relates to #498