Page MenuHomePhabricator

Move rate limits configuration from route to virtual host
Closed, ResolvedPublic

Description

We have implemented the rate limits on a route level, because we want the documentation portal to be exempt from them. However, the list of limit excemt routes will probably not grow, while the list of api routes will be expanding. It would be better if we could configure the limits on a virtual host level, and exclude the two routes representing the documentation portal.

However, envoy does not support that. This task is tracking designing the improvement to envoy, implementing it and using it in our gateway.

Event Timeline

• Pchelolo added a subscriber: • Clarakosi.

Poked some more into it. Trying to formulate a proposal for envoy to include a ignore_vh_rate_limits property made me realize it doesn't quite make sense - descriptors are cheap, so we should just add an unused but meaningful descriptor to every route, and set include_vh_rate_limits to true for API routes and false for wiki routes. The descriptor I have in mind is a generic_key with route name. However, generic_key action produces a very ugly looking descriptor since it's impossible to change the descriptor key. Thus I proposed https://github.com/envoyproxy/envoy/issues/12702 with @Clarakosi is going to implement.

So the plan is:

  1. Add a meaningless route_name generic key descriptor to every route and move rate limit config to VH level, use properly include_vh_rate_limits
  2. Implement envoy feature to make nice descriptors, once 1.16 is done, use it.

Change 621044 had a related patch set uploaded (by Ppchelko; owner: Ppchelko):
[operations/deployment-charts@master] Move rate_limits configration to the VH level

https://gerrit.wikimedia.org/r/621044

Alternatively, I've filed https://github.com/envoyproxy/envoy/issues/12714 for an even better solution. We'll see what the maintainers think.

Alternatively, I've filed https://github.com/envoyproxy/envoy/issues/12714 for an even better solution. We'll see what the maintainers think.

The maintainers liked the idea and merged https://github.com/envoyproxy/envoy/pull/12855 a week ago.

Yeah, we have landed quite a few PRs there and now waiting for the next release to be cut. Don't want to update to pre-release software.

Change 692404 had a related patch set uploaded (by Clarakosi; author: Clarakosi):

[operations/deployment-charts@master] api-gateway: Implement new ratelimit configurations from envoy 1.16

https://gerrit.wikimedia.org/r/692404

Change 692404 merged by jenkins-bot:

[operations/deployment-charts@master] api-gateway: Implement new ratelimit configurations from envoy 1.16

https://gerrit.wikimedia.org/r/692404

Change 621044 abandoned by Ppchelko:

[operations/deployment-charts@master] Move rate_limits configration to the VH level

Reason:

Did it.

https://gerrit.wikimedia.org/r/621044