-
Notifications
You must be signed in to change notification settings - Fork 14
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
MEN-7733: Rate limits for devices APIs #202
base: main
Are you sure you want to change the base?
Conversation
c0a5306
to
58e6c52
Compare
I was also wondering if we need it here at all. |
Ticket: MEN-7743 Signed-off-by: Alf-Rune Siqveland <[email protected]>
Ticket: MEN-7743 Signed-off-by: Alf-Rune Siqveland <[email protected]>
Added adaptive ratelimiting for devices APIs based on the `max_devices` limit. Two new configuration options are exposed: * `ratelimits.interval` - duration until the quota resets * `ratelimits.quotas` - mapping plan names to quota weights. The final burst limit is computed as `ratelimits.quotas[plan] * max_devices` The rate limiting counter is independent for each API path (independent of method and version). Ticket: MEN-7744 Changelog: Commit Signed-off-by: Alf-Rune Siqveland <[email protected]>
Changelog: Title Ticket: MEN-7760 Signed-off-by: Alf-Rune Siqveland <[email protected]>
Signed-off-by: Alf-Rune Siqveland <[email protected]>
Signed-off-by: Alf-Rune Siqveland <[email protected]>
Signed-off-by: Alf-Rune Siqveland <[email protected]>
Merging these commits will result in the following changelog entries: Changelogsmender-server (MEN-7733)New changes in mender-server since main: Features
|
Added adaptive ratelimiting for devices APIs based on the max_devices
limit. Two new configuration options are exposed:
ratelimits.interval
- duration until the quota resetsratelimits.quotas
- mapping plan names to quota weights. The finalburst limit is computed as ratelimits.quotas[plan] * max_devices
The rate limiting counter is independent for each API path (independent
of method and version).
I also added caching for getting limits since the rate limiting depends on getting the device limit.
Tip
To test the implementation you can use the following compose override
By manually setting the max devices for the "empty tenant" you can adjust the rate limits for open source:
Note
Open source does not have plans, so the RATELIMITS_QUOTAS configuration is ineffectual (but required). The default quota factor is set to 1.0.