Urgent.News

What's breaking now, across thousands of outlets.

Tech

Rate limiting algorithms explained: Token Bucket vs Sliding Window vs Fixed Window

Rate limiting sounds simple: count requests, block when over the limit. But the algorithm you choose changes how your API behaves under load. Here's what's actually happening. Fixed Window The simplest algorithm. Count requests in a fixed time window (e.g. 60 seconds). When the counter hits the limit, block until the window resets. Window: [0s -------- 30s -------- 60s] Requests: 1 2 3 4 5 ... 30…

Rate limiting algorithms dictate how an API behaves under heavy load. The three main algorithms are Fixed Window, Token Bucket, and Sliding Window. Fixed Window is the simplest, counting requests in a set time window. When the limit is reached, further requests are blocked until the window resets. This can cause boundary spikes, where a client sends requests right before and after the window boundary, exceeding the limit within a short period.

Token Bucket allows bursts by giving each client a bucket of tokens that refill at a constant rate. Each request costs one token, so if the bucket is empty, the request is denied. This lets clients send short bursts above the average rate. Sliding Window is similar to Fixed Window but the window slides continuously over the last N seconds, counting requests within this sliding window.

This eliminates boundary spikes and provides smooth rate limiting. GCRA (Generic Cell Rate Algorithm) is used in telecom networks, tracking the theoretical arrival time of the next allowed request for very smooth and memory-efficient rate limiting. Leaky Bucket is another approach where requests enter a bucket that leaks at a constant rate, producing a constant output rate regardless of input spikes.

In summary, Fixed Window is simple but prone to boundary spikes, while Token Bucket is usually the better default for bursty traffic with natural bursts allowed. Sliding Window offers smooth behavior without boundary spikes. GCRA provides the smoothest rate limiting for high-throughput APIs. Leaky Bucket is useful for background jobs or APIs needing a constant processing rate. The choice depends on the specific traffic pattern and rate limiting requirements.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

Meta's Crawler Goes Live Oct 30. Your Real Deadline Is Oct 29.

Five days left until Meta's crawl clause kicks in. Actually — four. And if you're planning to touch your robots.txt on the morning of October 30th, you've already missed it.

  • Meta's robots.txt change deadline moves to October 29, 2026
  • Businesses must authorize Meta for website crawling and data use
  • Verify robots.txt changes by checking for outdated files and server disagreements

From 1,464 Unrouted Nets to Zero — But I'm Still Not Calling This Board Manufacturable

TL;DR Part 2 of letting an AI agent (Codex, driving KiCad through its CLI) design my Raspberry Pi CM4 Mini-ITX IO board. The board is now fully routed and adopted as the official design : ERC 0, DRC…

  • Raspberry Pi CM4 Mini-ITX IO board formally verified as routeable on October 25
  • Fault simulation leaves -1.35 V on power controller pin, not explained
  • Board labeled as engineering prototype, not to be fabricated

More from Sunday 25 October →