Skip to content

Add benchmark for context handler#7047

Merged
knative-prow-robot merged 1 commit intoknative:masterfrom
MIBc:benchmark-activator
Feb 27, 2020
Merged

Add benchmark for context handler#7047
knative-prow-robot merged 1 commit intoknative:masterfrom
MIBc:benchmark-activator

Conversation

@MIBc
Copy link
Copy Markdown
Contributor

@MIBc MIBc commented Feb 27, 2020

/lint

Fixes: Part of ##6749

Proposed Changes

  • Add benchmark for context handler.

Release Note
None

Benchmark Result

goos: linux
goarch: amd64
pkg: knative.dev/serving/pkg/activator/handler
BenchmarkContextHandler/context_handler_success-sequential-4         	  316872	      3824 ns/op	    2072 B/op	      19 allocs/op
BenchmarkContextHandler/context_handler_success-parallel-4           	  407049	      2902 ns/op	    2072 B/op	      19 allocs/op
BenchmarkContextHandler/context_handler_failure-sequential-4         	   72049	     16485 ns/op	    5463 B/op	      46 allocs/op
BenchmarkContextHandler/context_handler_failure-parallel-4           	   62166	     18198 ns/op	    5535 B/op	      46 allocs/op

@googlebot googlebot added the cla: yes Indicates the PR's author has signed the CLA. label Feb 27, 2020
@knative-prow-robot knative-prow-robot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Feb 27, 2020
Copy link
Copy Markdown
Contributor

@knative-prow-robot knative-prow-robot left a comment

Choose a reason for hiding this comment

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

@MIBc: 0 warnings.

Details

In response to this:

/lint

Fixes: Part of ##6749

Proposed Changes

  • Add benchmark for context handler.

Release Note
None

Benchmark Result

goos: linux
goarch: amd64
pkg: knative.dev/serving/pkg/activator/handler
BenchmarkContextHandler/context_handler_success-sequential-4         	  316872	      3824 ns/op	    2072 B/op	      19 allocs/op
BenchmarkContextHandler/context_handler_success-parallel-4           	  407049	      2902 ns/op	    2072 B/op	      19 allocs/op
BenchmarkContextHandler/context_handler_failure-sequential-4         	   72049	     16485 ns/op	    5463 B/op	      46 allocs/op
BenchmarkContextHandler/context_handler_failure-parallel-4           	   62166	     18198 ns/op	    5535 B/op	      46 allocs/op

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot
Copy link
Copy Markdown
Contributor

Hi @MIBc. Thanks for your PR.

I'm waiting for a knative member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Details

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@knative-prow-robot knative-prow-robot added needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. area/autoscale area/networking labels Feb 27, 2020
@MIBc
Copy link
Copy Markdown
Contributor Author

MIBc commented Feb 27, 2020

/assign @markusthoemmes

Copy link
Copy Markdown
Contributor

@markusthoemmes markusthoemmes left a comment

Choose a reason for hiding this comment

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

/ok-to-test

Thanks!

baseHandler := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {})

handler := NewContextHandler(ctx, baseHandler)
req := httptest.NewRequest(http.MethodGet, "http://example.com", nil).WithContext(ctx)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I don't think we should attach the context here. It's not needed AFAIK.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

}
ctx, cancel, _ := rtesting.SetupFakeContextWithCancel(&testing.T{})
defer cancel()
revID := types.NamespacedName{Namespace: testNamespace, Name: testRevName}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is redundant. You can just use testNamespace and testRevName when creating the revision below.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

Comment on lines +90 to +99
}{
{
label: "context handler success",
revisionName: testRevName,
},
{
label: "context handler failure",
revisionName: "fake",
},
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
}{
{
label: "context handler success",
revisionName: testRevName,
},
{
label: "context handler failure",
revisionName: "fake",
},
}
}{{
label: "context handler success",
revisionName: testRevName,
}, {
label: "context handler failure",
revisionName: "fake",
}}

You can collapse slice notations like this to spare some indentation and to improve readability a bit.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Done.

@knative-prow-robot knative-prow-robot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Feb 27, 2020
* Add benchmark for context handler.
@MIBc MIBc force-pushed the benchmark-activator branch from 4835e66 to 3d4a8c2 Compare February 27, 2020 10:10
@knative-test-reporter-robot
Copy link
Copy Markdown

The following jobs failed:

Test name Triggers Retries
pull-knative-serving-autotls-tests 0/3
pull-knative-serving-upgrade-tests pull-knative-serving-upgrade-tests 1/3

Failed non-flaky tests preventing automatic retry of pull-knative-serving-autotls-tests:

test/e2e/autotls.TestAutoTLS
test/e2e/autotls.TestAutoTLS/HTTP01

Copy link
Copy Markdown
Contributor

@markusthoemmes markusthoemmes left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Feb 27, 2020
@knative-prow-robot
Copy link
Copy Markdown
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: markusthoemmes, MIBc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details 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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 27, 2020
@MIBc
Copy link
Copy Markdown
Contributor Author

MIBc commented Feb 27, 2020

/retest

@knative-prow-robot knative-prow-robot merged commit aaf6d4c into knative:master Feb 27, 2020
@MIBc MIBc deleted the benchmark-activator branch February 29, 2020 03:14
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. area/autoscale area/networking cla: yes Indicates the PR's author has signed the CLA. lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants