News for hackers. Stuff that matters.
Re:Gubernator: Cloud-Native Distributed Rate Limiting for Mi... by haolez on Monday July 29, 2019 @05:24PM (#20559607)
Is there something similar, but for outbound requests? The motivation is to be “polite” when accessing third party APIs regarding the rate limit.
Re:Gubernator: Cloud-Native Distributed Rate Limiting for Mi... by chosenken on Monday July 29, 2019 @06:02PM (#20559931)
I think this could be used for both incoming and outgoing requests. From what I gathered reading the docs and API, this doesn't actually forward your request to the API, it just keeps track of rate's and limits, leaving the actual limiting up to you. Its a microservice that keeps track of limits for you, and is highly distributed.

Basically, and I can be totally wrong, what it looks like is you send a rate limit request stating I'm doing 1 hit, I can do 100 hits a minute, am I over limit? Gubernator responds with either a status 0 (no, under limit), how many requests you have left, and the time the rate limit will reset. Or it will return 1 (yes, over limit), the time the limit resets, and you then have to hold your request until the reset time.

So you could use this as a self imposed rate limit for external services. I think the confusion is from the announcement, it sounded like this was a proxy type service that would hold your request until the limit was met. From what I read, it looks like you ask for the rate limit status, then its up to you to actually limit your requests.

Re:Gubernator: Cloud-Native Distributed Rate Limiting for Mi... by Denzel on Monday July 29, 2019 @05:56PM (#20559879)
They call this out as a use-case that's supported by Gubernator:

    Egress limiting – Blasting external SMTP servers with millions of messages is No Bueno.
Re:Gubernator: Cloud-Native Distributed Rate Limiting for Mi... by probablybroken on Tuesday July 30, 2019 @04:34AM (#20563087)
I'd usually use a queue + worker for this purpose. You will have to work out how to deal with old requests, backlogs, etc.. But then, if you are considering effectively forcibly making requests time out to internal servers, you will also need a strategy for handling that, retries, etc.
Re:Gubernator: Cloud-Native Distributed Rate Limiting for Mi... by chatmasta on Monday July 29, 2019 @06:46PM (#20560260)
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.
Re:Gubernator: Cloud-Native Distributed Rate Limiting for Mi... by haolez on Monday July 29, 2019 @07:15PM (#20560481)
I’m not familiar with these tools (yet). Why do I need a forward proxy (squid) connected to this haproxy instance?
Re:Gubernator: Cloud-Native Distributed Rate Limiting for Mi... by chatmasta on Monday July 29, 2019 @07:17PM (#20560495)
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.

Re:Gubernator: Cloud-Native Distributed Rate Limiting for Mi... by dijit on Monday July 29, 2019 @05:50PM (#20559838)
A leaky bucket?