A Comparative Survey of API Rate-Limiting Algorithms: Token Bucket, Leaky Bucket, and Sliding Window

Rate limiting is a foundational mechanism for protecting networked services and application programming interfaces (APIs) from overload, abuse, and cascading failure. A wide range of algorithms has been proposed to enforce request-rate constraints, each offering different trade-offs between burst tolerance, memory footprint, timing precision, and implementation complexity. This paper surveys five widely used rate-limiting techniques: the token bucket, the leaky bucket, the fixed window counter, the sliding window log, and the sliding window counter. For each algorithm we describe the underlying mechanism, summarize its principal advantages and limitations, and compare the techniques both qualitatively and experimentally. We implement all five algorithms and evaluate them on an identical synthetic traffic trace containing two artificial burst events, reporting acceptance rate, peak instantaneous throughput, and burst behavior for each. The results show that the token bucket and leaky bucket are decision-equivalent as admission meters, that the sliding window log is the only algorithm with zero tolerance for exceeding its configured limit, and that the fixed and sliding window counters fall predictably between these extremes. We conclude with concrete guidance on selecting an algorithm based on measured traffic characteristics and system constraints.

Authors

Publication Details

Journal
Zenodo (CERN European Organization for Nuclear Research)
Published
2026-09-05
DOI
https://doi.org/10.5281/zenodo.22391340
Primary Topic
Software System Performance and Reliability
Type
preprint
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
preprint

A Comparative Survey of API Rate-Limiting Algorithms: Token Bucket, Leaky Bucket, and Sliding Window

Umair Saleem
Zenodo (CERN European Organization for Nuclear Research)
Software System Performance and Reliability
preprint

A Comparative Survey of API Rate-Limiting Algorithms: Token Bucket, Leaky Bucket, and Sliding Window

Umair Saleem
preprint en

Abstract

Rate limiting is a foundational mechanism for protecting networked services and application programming interfaces (APIs) from overload, abuse, and cascading failure. A wide range of algorithms has been proposed to enforce request-rate constraints, each offering different trade-offs between burst tolerance, memory footprint, timing precision, and implementation complexity. This paper surveys five widely used rate-limiting techniques: the token bucket, the leaky bucket, the fixed window counter, the sliding window log, and the sliding window counter. For each algorithm we describe the underlying mechanism, summarize its principal advantages and limitations, and compare the techniques both qualitatively and experimentally. We implement all five algorithms and evaluate them on an identical synthetic traffic trace containing two artificial burst events, reporting acceptance rate, peak instantaneous throughput, and burst behavior for each. The results show that the token bucket and leaky bucket are decision-equivalent as admission meters, that the sliding window log is the only algorithm with zero tolerance for exceeding its configured limit, and that the fixed and sliding window counters fall predictably between these extremes. We conclude with concrete guidance on selecting an algorithm based on measured traffic characteristics and system constraints.

Zenodo (CERN European Organization for Nuclear Research)
Peace, Justice and strong institutions
Software System Performance and Reliability
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.