aditya109 / aditya109/API-Rate-Limiter

Create golang API rate limiting middleware

Open
#7 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Python
Stars
0
Forks
0
PR merge metrics
No merged PRs in 30d

Description

The rate limiter will be a router, having the following features:

- According to the requirements mentioned in [README.md](https://github.com/aditya109/API-Rate-Limiter/blob/main/README.md), the rate-limiter is going to be a server.
- The rate-limiting-server needs to be scalable, but all of gateway instances needs to use a common database.
- For scalability we can build an image and run it as Deployment on the same cluster.
- The rate-limiter needs to:
- identify the host from the incoming process request,
- create a host-machine identifier,
- attach a rate timeout to it, and it within the shared database.
- When an request is made, the rate-limiter should be the first entity to receive that request.
- Upon receiving the request, checks can be implemented for validating the request.
- Extracted host-machine identifier needs to be validated against the database entries.
- If request is under the agreed upon contract, the request is made by the rate-limiting-server to the K8s service.
- If request is not under the agreed upon contract, the request is rejected by the rate-limiting-server.

> For cleaning up of attached database, we can write a job which can run as a `crob-job` at set times.

- For validation/throttling of APIs we will be implementing [token bucket algorithm](https://en.wikipedia.org/wiki/Token_bucket) (which shall prohibit the request overflow) and followed by [leaky bucket algorithm](https://en.wikipedia.org/wiki/Leaky_bucket) (which shall ensure constant data rate getting injecting onto the network).

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.