Skip to content

Auto Configured Rate Limiting Support #45182

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

Closed
ardatosun opened this issue Apr 14, 2025 · 2 comments
Closed

Auto Configured Rate Limiting Support #45182

ardatosun opened this issue Apr 14, 2025 · 2 comments
Labels
for: external-project For an external project and not something we can fix

Comments

@ardatosun
Copy link

Hi Spring team,

I'd like to propose adding first class support for rate limiting via Spring Boot auto configuration.

Rate limiting is a fundamental concern in modern applications, especially for public APIs, multi-tenant systems and similar use cases. In real world scenarios where we usually run our code as distributed microservices, it becomes more critical.
While building custom rate limiting solutions for my company, I realized that many developers have had to implement this increasingly common requirement of rate limiting manually, as evident from blog posts and examples online. As someone who enjoys developing applications using Spring Boot, it felt intuitive that rate limiting should be a built-in feature as in an auto configuration support out of the box. Here is the core idea:

  • A simple @RateLimit annotation to mark rate-limited endpoints.
  • A property driven configuration system to declare rules per "rate limit use case".
  • Pluggable resolvers for rate limit identifiers e.g. resolving IP addresses, extracting user/client info from JWT claims
  • Backend support with auto configured key stores like Redis e.g. Redisson, Spring Data Redis
  • Out-of-the-box Spring boot integration with minimal manual setup e.g. @EnableRateLimiting

I'd love to hear your thoughts on:

  • Whether this kind of feature aligns with Spring Boot's goals and philosophy for auto-configuration.
  • If yes, whether we could discuss what such contribution might look like.

I have some work-in-progress ideas and would be happy to share them if the direction seems promising.

Thanks.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 14, 2025
@wilkinsona
Copy link
Member

Thanks for the suggestion. This feels to me like a Spring Framework feature for which Spring Boot could then provide auto-configuration. This would also allow other projects such as Spring Security to provide resolvers for rate limit identifiers which they could not do if the resolver API was part of Spring Boot.

There was some discussion about rate limiting in Spring Framework several years ago but the issue was ultimately declined. The landscape has undoubtedly changed in the almost 9 years since then so you may want to open a new Framework issue for things like @RateLimit, the plug point for resolvers, and @EnableRateLimiting. If you create such an issue, please comment here with a link to it. In the interim, I'll close this one and we can re-open it in the future should the suggested Framework enhancement be accepted.

@wilkinsona wilkinsona closed this as not planned Won't fix, can't repro, duplicate, stale Apr 14, 2025
@wilkinsona wilkinsona added for: external-project For an external project and not something we can fix and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 14, 2025
@ardatosun
Copy link
Author

Thanks for the answer @wilkinsona , I've created an issue in Spring Framework spring-projects/spring-framework/issues/34754

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: external-project For an external project and not something we can fix
Projects
None yet
Development

No branches or pull requests

3 participants