aditya109 / aditya109/API-Rate-Limiter

Create golang API rate limiting middleware

未关闭
#7 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
enhancement
主要语言
Python
星标
0
派生
0
PR 合并指标
30 天内没有已合并 PR

描述

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).

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。