https://github.com/bhupesh-v/ratelimiter-demo
A Go app to demonstrate API Rate Limiting using Leaky Bucket Algorithm (WIP)
https://github.com/bhupesh-v/ratelimiter-demo
leaky-bucket rate-limiter rate-limiting
Last synced: 3 months ago
JSON representation
A Go app to demonstrate API Rate Limiting using Leaky Bucket Algorithm (WIP)
- Host: GitHub
- URL: https://github.com/bhupesh-v/ratelimiter-demo
- Owner: Bhupesh-V
- Created: 2022-04-13T12:57:28.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2022-04-19T14:53:21.000Z (over 3 years ago)
- Last Synced: 2025-03-19T15:21:15.943Z (7 months ago)
- Topics: leaky-bucket, rate-limiter, rate-limiting
- Language: Go
- Homepage:
- Size: 5.86 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is a sample (incomplete) implementation of the Leaky Bucket Algorithm for API Rate limiting
## Installation
1. Clone the repo
```
git clone https://github.com/Bhupesh-V/ratelimiter-demo
```
2. Start the server
```
go run main.go
```Try visiting the dev server at localhost:8080 and making quick requests. Play with capacity in `ratelimiter.CreateUserBucket()`
### TODO
- Fix support for concurrent requests
- Add benchmarks
- Better interface to choose between the 4 algorithms for rate-limiting
- Pick user-ids, tokens from env or some kind of configuration
- Interface for reading from a global distributed cache
- Interface for making requests/user count configurable