API Rate-Limiting

Sraban Pahadasingh    April 14, 2020 06:17 PM

Implementing API Rate-Limiting

  1. Request Queues:

    • Ex. ASQS(Amazon Simple Queue Service) is a readymade request queue library maintianed regularly.
    • Some library take 2 request per second from the queue and remaining kept in the queue for processing.
    • Many custom "request-rate-limiter" library are avaialbe in package manager
  2. Throttling

    • API is used by setting up a temporary state, allowing the API to assess each request. When the throttle is triggered, a user may either be disconnected or simply have their bandwidth reduced.
    • Possible at the application, API, or user level, throttling is a popular method to rate-limit APIs
  3. Rate-limiting Algorithms
    • "Leaky Bucket" is a algorithim which translate requests into FIFO format and processing the items on the queue on a regular rate.
    • "Sliding Log" is time stampped algorithim, the sum of the logs are calculated to determine the request rate. if the request exceeds the limit threshold, they are simply queued.





Comments powered by Disqus