-
Notifications
You must be signed in to change notification settings - Fork 5.3k
Description
Title: Is local rate limiting per worker thread or per envoy instance?
Description:
From reading the envoy documentation, I was under the impression that the local rate limiting is per envoy instance while the global rate limiting can be used to share/apply the limits across multiple envoy nodes (via the grpc service). But after reading the local rate limit code here, it seems to me that the token bucket is local to the filter. Envoy's threading model documentation suggests that each worker thread initializes a separate set of listeners including all the filters. That implies the token bucket is actually local to each worker thread and not shared across the worker threads.
Is my understanding correct? If that's the case, does that mean we need to divide the local rate limits in envoy config by the max number of configured worker threads? That sounds really weird as the worker threads may not be fully balanced.
Or may be I'm missing something and the token bucket is indeed shared with other worker threads (the fact that it's an atomic variable shows it's designed to be shared with other threads). Sorry, I'm a complete newbie to envoy stack and trying to learn the threading model with respect to the filter instances.
[optional Relevant Links:]
https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/other_features/local_rate_limiting
https://www.envoyproxy.io/docs/envoy/latest/intro/arch_overview/other_features/global_rate_limiting