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

Enable throttler in activator #3139

Merged
merged 15 commits into from
Feb 12, 2019

Conversation

vvraskin
Copy link
Contributor

@vvraskin vvraskin commented Feb 8, 2019

Fixes #2381

Proposed Changes

  • Enable throttler in activator/main.go and in pkg/activator/handler/handler.go.
  • Define endpoint observer and revision observers in the main method.
  • Return 503 in case of throttler overflow (should not happen unless the BreakersQueueDepth is reached), and 502 in case if the revision is not found (should not happen)
  • See the reduction of previously observed 503s - Buffer overload requests in Activator #1846 (comment)
  • Extend existing unit tests

Release Note

Throttle requests in activator in case of overflow.

@knative-prow-robot knative-prow-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 8, 2019
Copy link
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.

@vvraskin: 1 warning.

In response to this:

Fixes #2381

Proposed Changes

  • Enable throttler in activator/main.go and in pkg/activator/handler/handler.go.
  • Define endpoint observer and revision observers in the main method.
  • Return 503 in case of throttler overflow (should not happen unless the BreakersQueueDepth is reached), and 502 in case if the revision is not found (should not happen)
  • See the reduction of previously observed 503s - Buffer overload requests in Activator #1846 (comment)
  • Extend existing unit tests

Release Note

Throttle requests in activator in case of overflow.

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.

pkg/activator/throttler.go Outdated Show resolved Hide resolved
Copy link
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.

Yay, thanks again for breaking the PRs into small pieces. I cannot stress enough how much that facilitated reviewing.

This looks good throughout, my comments are mostly refactors and suggestions. Haven't looked at the tests just yet.

cmd/activator/main.go Outdated Show resolved Hide resolved
cmd/activator/main.go Outdated Show resolved Hide resolved
cmd/activator/main.go Outdated Show resolved Hide resolved
cmd/activator/main.go Outdated Show resolved Hide resolved
cmd/activator/main.go Show resolved Hide resolved
cmd/activator/main.go Outdated Show resolved Hide resolved
cmd/activator/main.go Outdated Show resolved Hide resolved
cmd/activator/main.go Outdated Show resolved Hide resolved
pkg/activator/handler/handler.go Outdated Show resolved Hide resolved
pkg/activator/handler/handler.go Show resolved Hide resolved
@vvraskin
Copy link
Contributor Author

vvraskin commented Feb 8, 2019

Regarding the tests.
I actually see that they are bit mixed up with the current handler tests (since the throttling logic is clenched in the retrying handler at the moment). I'd like to refactor them in the upcoming PRs though. Where I'm planning to replace the revision polling with the Informer. This should allow to split the Throttling handler from the Retrying logic/Metric pushing handler. And it should be way easier to test the throttler without the overhead of the rest of the activator.

Copy link
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.

I'm fine with this as-is, thanks for making the quick changes @vvraskin

/approve

/cc @vagababov

Would you do me the honors and give this a second look? I'll leave to you to leave a LGTM. Thanks!

@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 8, 2019
pkg/activator/handler/handler_test.go Outdated Show resolved Hide resolved
pkg/activator/handler/handler_test.go Show resolved Hide resolved
pkg/activator/handler/handler_test.go Show resolved Hide resolved
@vvraskin
Copy link
Contributor Author

The previous tests failed because of "Scale to 50" - will be rerun after the push. There was one failure of "BuildPipelineAndServe" which looked like an istio/envoy blip with "no healthy upstream".

Copy link
Member

@mattmoor mattmoor left a comment

Choose a reason for hiding this comment

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

Bunch of superficial comments, but one high-level one: we need to make sure we can horizontally scale the activator, and so we need to account for it's replication.

thanks for breaking this up.

cmd/activator/main.go Outdated Show resolved Hide resolved
cmd/activator/main.go Show resolved Hide resolved
cmd/activator/main.go Outdated Show resolved Hide resolved
cmd/activator/main.go Outdated Show resolved Hide resolved
cmd/activator/main.go Outdated Show resolved Hide resolved
cmd/activator/main.go Show resolved Hide resolved
pkg/activator/handler/handler_test.go Outdated Show resolved Hide resolved
pkg/activator/throttler_test.go Outdated Show resolved Hide resolved
pkg/activator/handler/handler_test.go Outdated Show resolved Hide resolved
pkg/activator/handler/handler.go Show resolved Hide resolved
@knative-prow-robot knative-prow-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels Feb 11, 2019
Copy link
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.

One last nit.

Do you plan on writing an E2E test, that asserts that the burst behavior is as we expect it?

cmd/activator/main.go Show resolved Hide resolved
@knative-prow-robot knative-prow-robot removed the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Feb 12, 2019
@vvraskin
Copy link
Contributor Author

@markusthoemmes
Yeap, I'm planning to add an e2e tests after this one gets in.
On a side note, the latest unit tests/build failures due to a single left-over method, I cleaned it up.

@tcnghia could you please review/approve? I touched the reconciler files.
@mattmoor I moved the DeleteFunc to the Endpoints informer.

@knative-metrics-robot
Copy link

The following is the coverage report on pkg/.
Say /test pull-knative-serving-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/activator/throttler.go 98.0% 98.0% 0.0

@vvraskin
Copy link
Contributor Author

The preUpgrade test seems to be flaky in the pipeline, and it passes locally, so
/test pull-knative-serving-upgrade-tests

@vvraskin
Copy link
Contributor Author

Unrelated unit test failure,
/test pull-knative-serving-unit-tests

Copy link
Contributor

@vagababov vagababov 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 Feb 12, 2019
@markusthoemmes
Copy link
Contributor

/assign @mattmoor

For the leftover approval.

@knative-prow-robot knative-prow-robot removed the lgtm Indicates that a PR is ready to be merged. label Feb 12, 2019
Copy link
Member

@mattmoor mattmoor 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 12, 2019
@knative-prow-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: markusthoemmes, mattmoor, vvraskin

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 Feb 12, 2019
@mattmoor mattmoor added this to the Serving 0.4 milestone Feb 12, 2019
@knative-prow-robot knative-prow-robot merged commit 262cb03 into knative:master Feb 12, 2019
@vvraskin vvraskin deleted the enable_throttler branch February 13, 2019 13:33
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. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants