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 keys in redis to only configured rate limit values #13847

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

narendrapatel
Copy link

Summary

As of now the response rate limit plugin creates and updates in redis all limit parameter keys(sec, min, hour, day and year) irrespective of whether they are defined.
This change aims to restrict keys in redis to only the configured rate limit parameters.

It will help:

  • Optimize redis key space. If only one rate limit parameter(f.e minute) is defined then we will have only 1 key instead of earlier 5 keys.

  • More importantly, since the key is only created in redis when the limit is defined, any past value will not be considered for new rate limit. For example, if we initially configured to limit at 10 req/min and now we add new limit of 50 req/hour then as per current plugin the if 50 req have been exhausted before the new limit is defined, then it will be considered and the rate limit will be immediately applied where as the expectation would be to consider the new limit from now on.

Checklist

  • The Pull Request has tests
  • A changelog file has been created under changelog/unreleased/kong or skip-changelog label added on PR if changelog is unnecessary. README.md
  • There is a user-facing docs PR against https://github.com/Kong/docs.konghq.com - PUT DOCS PR HERE

Issue reference

Fix #[issue number]

@github-actions github-actions bot added plugins/response-ratelimiting cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee labels Nov 7, 2024
@team-eng-enablement team-eng-enablement added the author/community PRs from the open-source community (not Kong Inc) label Nov 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
author/community PRs from the open-source community (not Kong Inc) cherry-pick kong-ee schedule this PR for cherry-picking to kong/kong-ee plugins/response-ratelimiting size/XS
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants