golimit | Uber ringpop based distributed and decentralized rate | Runtime Evironment library
kandi X-RAY | golimit Summary
kandi X-RAY | golimit Summary
Golimit is Uber ringpop based distributed and decentralized rate limiter. It is horizontally scalable and is based on shared nothing architecture. Every node in system is capable of handling read and writes of counters. It is designed to offer sub milliseconds latency to caller application. Recommended deployment topology is sidecar model. Every golimit node keeps local and global counter for api counter and local value is synchronized with other nodes on configurable periodic interval or at defined threshold.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of golimit
golimit Key Features
golimit Examples and Code Snippets
Community Discussions
Trending Discussions on golimit
QUESTION
I have a microservice architecture application with multiple services polling an external API. The external API has a rate limiter of 600 requests per minute. How can I have all of my instances together stay below the shared 600 rate limit?
Google only brought me 3 solutions, the most promising being:
- myntra/golimit the most promising of the three, but I literally do not have a clue how to set that up.
- wallstreetcn/rate which only seems to reject when limit has been reached (my app needs to wait till it can make the request) and the
Every
function in therate.NewLimiter
func seems to be a different import / dependency which i cannot figure out which it is - manavo/go-rate-limiter has a "soft" limit which, obviously, could get me over the limit. Some endpoints I dont really mind if I cant access them for a few seconds, but other endpoint requests should work as much as possible.
Currently I have an amateur solution. The code below allows to me set a limit per minute and it sleeps in between requests to spread the requests over the minute. This client rate limit is per instance, thus I would have to hardcode divide the 600 requests by the amount of instances.
...ANSWER
Answered 2019-Jun-30 at 23:21if you want a global rate limiter, you need a place to maintain distributed state, such as zookeeper. Usually, we don't want to pay the overhead. Alternatively, you can set up a forward proxy (https://golang.org/pkg/net/http/httputil/#ReverseProxy), do rate limit in it.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install golimit
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page