Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

What's the difference between rate and burst? #58

Open
birdycn opened this issue Apr 11, 2021 · 4 comments
Open

What's the difference between rate and burst? #58

birdycn opened this issue Apr 11, 2021 · 4 comments

Comments

@birdycn
Copy link

birdycn commented Apr 11, 2021

	limit := redis_rate.Limit{
		Rate:   limitCfg.Burst,
		Burst:  limitCfg.Burst,
		Period: time.Duration(limitCfg.Second) * time.Second,
	}

Many times, the same values are used. What's the difference between them

@vmihailenco
Copy link
Member

In the leaking bucket analogy the burst is the initial water level in the bucket. Without it the first call to the rate limiter will fail (bucket will be empty).

@jose-zenledger
Copy link

@vmihailenco in the analogy, wouldn't requests fail when the bucket is full? New requests raise the water level and leak out when complete? In that interpretation I think everything works.

Either way the result is that the rate limiter doesn't rate limit so shouldn't this be patched?

@aleksficek
Copy link

@jose-zenledger your analogy makes sense with how leaky bucket works, not sure what @vmihailenco is saying here

@whongki
Copy link

whongki commented Sep 28, 2023

@vmihailenco in the analogy, wouldn't requests fail when the bucket is full? New requests raise the water level and leak out when complete? In that interpretation I think everything works.

Either way the result is that the rate limiter doesn't rate limit so shouldn't this be patched?

I feel like it's more a token bucket than a leaky bucket. That's why the water level is zero, you can not have request. the water level here works like a token.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants