Skip to content

Conversation

@alexzielenski
Copy link
Member

@alexzielenski alexzielenski commented Oct 20, 2023

What type of PR is this?

/kind feature

What this PR does / why we need it:

Which issue(s) this PR fixes:

Adds benchmarks of validation of Gateway API CRDs with and without ratcheting. Gateway API was chosen due to its extensive usage of CRD schema validations and CEL validiations.

To benchmark ratcheting we test ValidateUpdate(new, old) for the following sets of pairs of new and old:

  • For each valid and invalid test case, benchmark ValidateUpdate(validCase, invalidCase)
  • For each invalid test case, benchmark ValidateUpdate with every other invalid case, including itself

On my system the difference is minimal (and may be reduced further by #121343

goos: darwin
goarch: arm64
pkg: k8s.io/apiextensions-apiserver/test/integration
=== RUN   BenchmarkRatcheting
BenchmarkRatcheting
=== RUN   BenchmarkRatcheting/RatchetingEnabled
BenchmarkRatcheting/RatchetingEnabled
=== RUN   BenchmarkRatcheting/RatchetingEnabled/ValidXValid
BenchmarkRatcheting/RatchetingEnabled/ValidXValid
BenchmarkRatcheting/RatchetingEnabled/ValidXValid-20                   2         654126666 ns/op       550194772 B/op   9789306 allocs/op
    /Users/alex/go/src/k8s.io/kubernetes/staging/src/k8s.io/apiextensions-apiserver/test/integration/ratcheting_test.go:1893: Hits: 160
=== RUN   BenchmarkRatcheting/RatchetingEnabled/ValidXInvalid
BenchmarkRatcheting/RatchetingEnabled/ValidXInvalid
BenchmarkRatcheting/RatchetingEnabled/ValidXInvalid-20                 4         312041740 ns/op       260796202 B/op   4650428 allocs/op
    /Users/alex/go/src/k8s.io/kubernetes/staging/src/k8s.io/apiextensions-apiserver/test/integration/ratcheting_test.go:1901: Hits: 292
=== RUN   BenchmarkRatcheting/RatchetingEnabled/InvalidXInvalid
BenchmarkRatcheting/RatchetingEnabled/InvalidXInvalid
BenchmarkRatcheting/RatchetingEnabled/InvalidXInvalid-20              13          86722939 ns/op       73554363 B/op    1324085 allocs/op
    /Users/alex/go/src/k8s.io/kubernetes/staging/src/k8s.io/apiextensions-apiserver/test/integration/ratcheting_test.go:1909: Hits: 15219
=== RUN   BenchmarkRatcheting/RatchetingDisabled
BenchmarkRatcheting/RatchetingDisabled
=== RUN   BenchmarkRatcheting/RatchetingDisabled/ValidXValid
BenchmarkRatcheting/RatchetingDisabled/ValidXValid
BenchmarkRatcheting/RatchetingDisabled/ValidXValid-20                  2         631920688 ns/op       536041164 B/op   9622970 allocs/op
    /Users/alex/go/src/k8s.io/kubernetes/staging/src/k8s.io/apiextensions-apiserver/test/integration/ratcheting_test.go:1893: Hits: 0
=== RUN   BenchmarkRatcheting/RatchetingDisabled/ValidXInvalid
BenchmarkRatcheting/RatchetingDisabled/ValidXInvalid
BenchmarkRatcheting/RatchetingDisabled/ValidXInvalid-20                4         305517083 ns/op       254641550 B/op   4577617 allocs/op
    /Users/alex/go/src/k8s.io/kubernetes/staging/src/k8s.io/apiextensions-apiserver/test/integration/ratcheting_test.go:1901: Hits: 0
=== RUN   BenchmarkRatcheting/RatchetingDisabled/InvalidXInvalid
BenchmarkRatcheting/RatchetingDisabled/InvalidXInvalid
BenchmarkRatcheting/RatchetingDisabled/InvalidXInvalid-20             13          83273772 ns/op       69889626 B/op    1278588 allocs/op
    /Users/alex/go/src/k8s.io/kubernetes/staging/src/k8s.io/apiextensions-apiserver/test/integration/ratcheting_test.go:1909: Hits: 0
PASS
ok      k8s.io/apiextensions-apiserver/test/integration 11.808s

Special notes for your reviewer:

Based on #121016

/assign @apelisse
/sig api-machinery

Does this PR introduce a user-facing change?

NONE

Additional documentation e.g., KEPs (Kubernetes Enhancement Proposals), usage docs, etc.:

- [KEP]: https://kep.k8s.io/4008

@k8s-ci-robot k8s-ci-robot added the release-note-none Denotes a PR that doesn't merit a release note. label Oct 20, 2023
@k8s-ci-robot k8s-ci-robot added kind/feature Categorizes issue or PR as related to a new feature. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. labels Oct 20, 2023
@alexzielenski alexzielenski changed the title CRDValidationRatcheting: Add Benchmarks KEP-4008: CRDValidationRatcheting: Add Benchmarks Oct 24, 2023
@leilajal
Copy link
Contributor

/triage accepted

@k8s-ci-robot k8s-ci-robot added triage/accepted Indicates an issue or PR is ready to be actively worked on. and removed needs-triage Indicates an issue or PR lacks a `triage/foo` label and requires one. labels Oct 24, 2023
@alexzielenski alexzielenski force-pushed the apiserver/apiextensions/ratcheting-benchmarks branch 2 times, most recently from 46df451 to c0bdff4 Compare October 25, 2023 22:44
@apelisse
Copy link
Member

/lgtm
/approve
Thanks!

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 25, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 0b8ed37d309995b03fde36017a298588d7e59ac0

@alexzielenski alexzielenski force-pushed the apiserver/apiextensions/ratcheting-benchmarks branch from c0bdff4 to 3bfe568 Compare October 26, 2023 22:27
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 26, 2023
@k8s-ci-robot k8s-ci-robot requested a review from apelisse October 26, 2023 22:27
Copy link
Contributor

@jpbetz jpbetz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/approve
/lgtm

Noticed a minor typo, not blocking on it, but happy to retag if it gets fixed.

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 27, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: 640639351dc5d54c9504cbaca2f4b9457c943343

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: alexzielenski, apelisse, jpbetz

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 27, 2023
@alexzielenski alexzielenski force-pushed the apiserver/apiextensions/ratcheting-benchmarks branch from 3bfe568 to bc1bc01 Compare October 27, 2023 16:24
@k8s-ci-robot k8s-ci-robot removed the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 27, 2023
@k8s-ci-robot k8s-ci-robot requested a review from jpbetz October 27, 2023 16:24
@alexzielenski alexzielenski force-pushed the apiserver/apiextensions/ratcheting-benchmarks branch from bc1bc01 to 8c72be3 Compare October 27, 2023 17:31
@alexzielenski
Copy link
Member Author

/retest

@apelisse
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Oct 27, 2023
@k8s-ci-robot
Copy link
Contributor

LGTM label has been added.

Git tree hash: ab26df1982fd57163c9f837b724c3c3a87c9b3b8

@k8s-ci-robot k8s-ci-robot merged commit 7310ea0 into kubernetes:master Oct 27, 2023
@k8s-ci-robot k8s-ci-robot added this to the v1.29 milestone Oct 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/feature Categorizes issue or PR as related to a new feature. lgtm "Looks good to me", indicates that a PR is ready to be merged. needs-priority Indicates a PR lacks a `priority/foo` label and requires one. release-note-none Denotes a PR that doesn't merit a release note. sig/api-machinery Categorizes an issue or PR as relevant to SIG API Machinery. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. triage/accepted Indicates an issue or PR is ready to be actively worked on.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants