Open iluwatar opened 5 months ago
Hey @iluwatar, Thank you for detail explanation and i really like to share my knowledge (gain some more) regarding rate limiting pattern.
I want to give my time to this, can you please tell me how can i proceed further in right/good direction. Thank you!!
Hey @flow6979, maybe a good starting point would be to research how rate limiting has been implemented in popular open source API management solutions like these:
Kong - A scalable, open-source API gateway with a rich plugin ecosystem. Source Code
Tyk - An open-source API gateway and management platform with extensive features. Source Code
WSO2 API Manager - A comprehensive open-source API management tool for full lifecycle API management. Source Code
Gravitee.io - A flexible and modular API management platform with powerful access control and analytics. Source Code
API Umbrella - An open-source API management tool providing gateway functionalities and analytics. Source Code
KrakenD - A high-performance, open-source API gateway designed for scalability and flexibility. Source Code
Express Gateway - An API gateway built entirely on Express.js, focused on extensibility and ease of use. Source Code
DreamFactory - An open-source platform for generating APIs from various data sources with powerful management features. Source Code
Apache APISIX - A dynamic, high-performance open-source API gateway with a rich plugin ecosystem. Source Code
@iluwatar
We can try to implement different algorithms, which user can select on different choices?
public enum AlgorithmType { FIXED_WINDOW, SLIDING_WINDOW, TOKEN_BUCKET, LEAKY_BUCKET }
and also different Throttling Strategies:
public enum ThrottlingStrategyType { DELAY, REJECT, EXPONENTIAL_BACKOFF }
that would be beneficial?
Maybe we can also add a simple Circuit Breaker for failure with state of open, half open, closed etc?
which user can select from configuration:
--Algorithm Types by Endpoint --Format: endpoint=ALGORITHM_TYPE ratelimiter.algorithmByEndpoint.endpoint1=FIXED_WINDOW ratelimiter.algorithmByEndpoint.endpoint2=SLIDING_WINDOW ratelimiter.algorithmByEndpoint.endpoint3=TOKEN_BUCKET ratelimiter.algorithmByEndpoint.endpoint4=LEAKY_BUCKET
and for Throttling
--Throttling Strategies by Endpoint and Client Type --Format: endpoint.CLIENT_TYPE=THROTTLING_STRATEGY_TYPE ratelimiter.throttlingStrategiesByEndpointAndClientType.endpoint1.STANDARD=DELAY ratelimiter.throttlingStrategiesByEndpointAndClientType.endpoint1.PREMIUM=REJECT ratelimiter.throttlingStrategiesByEndpointAndClientType.endpoint2.STANDARD=EXPONENTIAL_BACKOFF ratelimiter.throttlingStrategiesByEndpointAndClientType.endpoint2.PREMIUM=DELAY
I can work on that module.
Sounds good @ylcn91, but according to my books @flow6979 is already working on this
@flow6979 let me know if any help needed, we can work together if you wish.
Hello @ylcn91 yes sure, lets work together. Can we have a google meet to discuss our findings/knowledge this sunday (or any other day you are comfortable with).
@ylcn91 @flow6979 I will like to train pls. I am interested. I have began reading up on the rate limiting pattern.
@iluwatar should we also include client Rate Limiting? I can build a Distributed Rate limiting for the api with Lua scripting
I have added some code to my fork. you can check it @flow6979 you can understand what I try to do, if not we can have some meeting.
This issue has been automatically marked as stale because it has not had recent activity. The issue will be unassigned if no further activity occurs. Thank you for your contributions.
@iluwatar I can take it up.
Description: The Rate Limiting design pattern is crucial in a microservices architecture to prevent abuse and ensure fair usage of resources. This pattern restricts the number of requests a service can handle within a specified timeframe, thereby enhancing reliability and performance by preventing overloading. This implementation will involve creating a mechanism to count and limit the number of incoming requests to a service, and take appropriate actions when the limit is exceeded.
Main Elements of the Pattern:
References:
Acceptance Criteria: