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

Limit not working? Rate Limit not honored as the Request Volumes Increase #35

Open
charlieding opened this issue Aug 24, 2018 · 1 comment

Comments

@charlieding
Copy link

I set the rate limit at 3 TPS. When I send 4 TPS, it works and I see 3TPS rate honored. However, when I put this into production, as the volumes go up, 3 TPS begins to break.
AT 10 TPS INPUT, I see ~4 TPS getting through the rate limiter.
AT 40 TPS INPUT, I see ~6 TPS getting through the rate limiter.

Any help is appreciated.

var limiter = require('express-limiter')(router, client);
limiter({
path: '/',
method: 'post',
onRateLimited: function (req, res, next) {
next({ message: 'Rate limit exceeded', status: 429 })
},
lookup: function(req, res, opts, next) {
opts.lookup = 'headers.id';
opts.total = 3; // 1 TPS
}
return next();
},
expire: 1000 // (1 seconds)
});

@charlieding charlieding changed the title Limit not working? I se Limit not working? Rate Limit not honored as the Request Volumes Increase Aug 24, 2018
@animir
Copy link

animir commented May 26, 2019

This package uses Get/Set approach, which is vulnerable on high traffic. Similar vulnerability was found on express-brute package.

rate-limiter-flexible package implements atomic increments.

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

2 participants