Member-only story

API Rate Limiting Strategies: Burst vs. Token Bucket vs. Fixed Window

Otutu Chidinma Janefrances
5 min readSep 22, 2023

A simple node application as a use case

Photo by Christopher Gower on Unsplash

API rate limiting is a crucial aspect of designing scalable and reliable APIs. It allows you to control the rate at which clients can make requests to your API, preventing abuse, ensuring fair usage, and maintaining system stability.

There are three popular rate-limiting strategies: Burst, Token Bucket, and Fixed Window.

Burst Rate Limiting

This is a straightforward strategy that permits a certain number of requests to be processed in a short burst while maintaining an overall rate limit. It is useful for accommodating occasional bursts of traffic.

How Burst Rate Limiting Works

  1. Set Two Parameters:
  • Burst Limit (B): The maximum number of requests allowed in a burst.
  • Rate Limit (R): The number of requests allowed per second on average.

2. Track Requests:

  • For each incoming request, decrease the burst limit by 1.
  • If the burst limit reaches zero, reject subsequent requests until it replenishes.

3. Replenish Burst Limit:

  • Gradually increase the burst limit over…

--

--

Otutu Chidinma Janefrances
Otutu Chidinma Janefrances

Written by Otutu Chidinma Janefrances

Software Developer | Content Creator| Writer

No responses yet