
Gubernator: Cloud-Native Distributed Rate Limiting for Microservices - medmunds
https://www.mailgun.com/blog/gubernator-cloud-native-distributed-rate-limiting-microservices
======
Scaevolus
Previous pun on Kubernetes->Gubernator : [https://github.com/kubernetes/test-
infra/tree/master/guberna...](https://github.com/kubernetes/test-
infra/tree/master/gubernator)

Etymology of Latin "guberno": From a non-Indo-European Mediterranean language;
akin to Ancient Greek κυβερνάω (kubernáō).

~~~
spxtr
Does this name have any significance other than what you said here and what
they say in this article?

------
haolez
Is there something similar, but for outbound requests? The motivation is to be
“polite” when accessing third party APIs regarding the rate limit.

~~~
chatmasta
You can use haproxy+squid for this purpose. Basically implement the rate
limiting on haproxy and send requests to squid “backend” that is a forward
proxy to the internet.

~~~
haolez
I’m not familiar with these tools (yet). Why do I need a forward proxy (squid)
connected to this haproxy instance?

~~~
chatmasta
Squid is useful as a forward proxy for a number of reasons, like caching.
Squid is often used for outbound proxying when you are anonymizing requests,
i.e. you might have squid bound to multiple network interfaces.

If all you need is rate limiting, you can probably skip squid.

------
jrockway
The most interesting part of this is the k8s integration to find your peers
and connect to them. I've wanted this for a variety of projects; I wonder if
this is worth extracting into a separate library?

~~~
newaccoutnas
Isn't that just Service Discovery?
[https://kubernetes.io/docs/concepts/services-
networking/serv...](https://kubernetes.io/docs/concepts/services-
networking/service/#discovering-services)

~~~
jrockway
Getting the list of endpoints is easy. Doing something with that list of
endpoints is the hard part.

------
Exuma
Is this something Envoy does? I just learned about it recently and it seemed
very cool.

------
bbmario
How does it know that a specific client is over the quota if it is stateless?

~~~
cbetti
It maintains zero configuration state. It is not completely stateless.

Consumption of available requests is maintained statefully in RAM. If your
Gubernator goes down, the quotas are effectively topped back up when
Gubernator returns from the dead, upon next request from that client.

~~~
bbmario
Oh, guess the documentation confused me. When it said stateless, I
automatically assumed no storage whatsoever, not even RAM.

------
jedberg
This looks very cool, but I don't understand why they didn't build their
entire caching infrastructure this way. Or to put it another way, why not
build all caching like this, and then use your standard cache for rate limits?

