Skip to content

Commit 3ff1f03

Browse files
committed
fix
1 parent b546c31 commit 3ff1f03

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

website/learning-center/api-gateway-rate-limiting.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ The token bucket algorithm maintains a bucket of tokens for each rate-limited en
3838
Token bucket allows short bursts up to the bucket capacity while enforcing an average rate over time. This makes it well-suited for APIs where occasional traffic spikes are acceptable but sustained overuse is not.
3939

4040
**Pros:** Permits controlled bursting, simple to implement, low memory footprint.
41+
4142
**Cons:** Burst size must be tuned carefully; overly generous bursts can still overwhelm backends.
4243

4344
### Leaky Bucket
@@ -47,6 +48,7 @@ The leaky bucket algorithm processes requests at a fixed rate, queuing excess re
4748
Leaky bucket is ideal for backends that require strictly uniform request rates, such as third-party APIs with their own rate limits or services with fixed connection pools.
4849

4950
**Pros:** Produces perfectly smooth output, prevents backend overload from bursts.
51+
5052
**Cons:** Higher latency for bursty traffic due to queuing, queue size requires tuning.
5153

5254
### Sliding Window
@@ -56,6 +58,7 @@ The sliding window algorithm divides time into overlapping windows and counts re
5658
For example, if the window is 60 seconds and the current position is 40 seconds into the window, the algorithm weights 33% of the previous window's count and 100% of the current window's count to determine if the limit is exceeded.
5759

5860
**Pros:** Accurate rate enforcement without boundary spikes, reasonable memory usage.
61+
5962
**Cons:** Slightly more complex to implement than fixed window.
6063

6164
### Fixed Window
@@ -65,6 +68,7 @@ The fixed window algorithm divides time into non-overlapping intervals and count
6568
Fixed window is the simplest algorithm but has a well-known boundary problem: a client can make double the intended rate by clustering requests at the end of one window and the beginning of the next. Despite this limitation, fixed window remains widely deployed due to its simplicity and low overhead.
6669

6770
**Pros:** Minimal memory and computation, easy to understand and debug.
71+
6872
**Cons:** Boundary burst problem allows temporary rate doubling.
6973

7074
### Algorithm Comparison

0 commit comments

Comments
 (0)