Internal service API Rate Limiter named Rate Limiter Service API (RLS)
Restful API
POST /throttleRequest
Description:
Consumer service calling this API upon first intercepting the external requests to validate its caller service with allowed tps limit. exception will be thrown if limit being reached.
Input:
SourceService: string
Response:
200 Status
Error:
Exceed TPS Limit
GET /getThrottleRule
Input:
SourceService: string
DestinationService: string
Output:
Tps: number
Error:
ServiceNameNotFound
PUT /setThrottleRule
Input:
SourceService: string
DestinationService: string
Tps: number
Output:
200 Status
Error:
ServiceNameNotFound
DynamoDB for storing policy and tps rate between services
Policy_Service tbl
TPS_Service_Relation tbl
When serviceA received requests from serviceB, serviceA will invoke Rate Limiter Service API (RLS). The RLS will determine if serviceB either exists in the policy and if the current traffics request from B exceed the rate limit.
Because this is for internal service, there is not required for API gateway/Load Balancing
HLD:
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?