Skip to content

alexthered/demo-api-rate-limiter

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Demo implementation of an API rate limiter with Spring Boot and Redis

In this demo, I implemented rate limiter with sliding window algorithm.

Note that in production, if your backend sits behind a load balancer, you will need to get the remote Ip from the header:

String ipAddress = request.getHeader("X-FORWARDED-FOR");

Requirement:

  • Redis
  • Java 8

For Redis client, I used Lettuce, which is shipped by default with Spring.

How to run:

  • Run a local Redis server. I used the Redis image from Docker.
  • Then just run ./gradlew bootRun

About

Demo of API rate limiter with Spring Boot and Redis

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages