Skip to content
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

Only allocate named logger if necessary in activator #11008

Merged

Conversation

markusthoemmes
Copy link
Contributor

Proposed Changes

Allocating a named logger is somewhat expensive (~ 10 allocs) so it's worth avoiding it, especially in high-speed components like the activator.

This defers allocation of the respective named logger to error cases.

Context handler benchmark

benchmark                                                         old ns/op     new ns/op     delta
BenchmarkContextHandler/context_handler_success-sequential-16     3258          924           -71.64%
BenchmarkContextHandler/context_handler_success-parallel-16       569           175           -69.24%
BenchmarkContextHandler/context_handler_failure-sequential-16     14659         14838         +1.22%
BenchmarkContextHandler/context_handler_failure-parallel-16       10980         11384         +3.68%

benchmark                                                         old allocs     new allocs     delta
BenchmarkContextHandler/context_handler_success-sequential-16     19             7              -63.16%
BenchmarkContextHandler/context_handler_success-parallel-16       19             7              -63.16%
BenchmarkContextHandler/context_handler_failure-sequential-16     45             38             -15.56%
BenchmarkContextHandler/context_handler_failure-parallel-16       45             38             -15.56%

benchmark                                                         old bytes     new bytes     delta
BenchmarkContextHandler/context_handler_success-sequential-16     2091          592           -71.69%
BenchmarkContextHandler/context_handler_success-parallel-16       2090          592           -71.67%
BenchmarkContextHandler/context_handler_failure-sequential-16     5086          4119          -19.01%
BenchmarkContextHandler/context_handler_failure-parallel-16       4882          3715          -23.90%

Release Note

NONE

/assign @julz @vagababov

@google-cla google-cla bot added the cla: yes Indicates the PR's author has signed the CLA. label Mar 22, 2021
@knative-prow-robot knative-prow-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. area/autoscale area/networking labels Mar 22, 2021
@codecov
Copy link

codecov bot commented Mar 22, 2021

Codecov Report

Merging #11008 (d2c1ec2) into main (05f16c6) will decrease coverage by 0.04%.
The diff coverage is 88.88%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main   #11008      +/-   ##
==========================================
- Coverage   87.99%   87.95%   -0.05%     
==========================================
  Files         188      188              
  Lines        9113     9113              
==========================================
- Hits         8019     8015       -4     
- Misses        839      842       +3     
- Partials      255      256       +1     
Impacted Files Coverage Δ
cmd/activator/main.go 0.00% <0.00%> (ø)
pkg/activator/handler/context_handler.go 96.00% <100.00%> (-0.30%) ⬇️
pkg/activator/handler/handler.go 95.12% <100.00%> (+0.25%) ⬆️
pkg/reconciler/revision/reconcile_resources.go 80.95% <0.00%> (-2.39%) ⬇️
pkg/activator/net/revision_backends.go 90.41% <0.00%> (-0.92%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 05f16c6...d2c1ec2. Read the comment docs.

Copy link
Member

@julz julz left a comment

Choose a reason for hiding this comment

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

/lgtm

@knative-prow-robot knative-prow-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 23, 2021
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: julz

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

@knative-prow-robot knative-prow-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Mar 23, 2021
@knative-prow-robot knative-prow-robot merged commit 4e5fde5 into knative:main Mar 23, 2021
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. 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.

4 participants