Fixed window edge burst: Users get double their limit at the top of each minute
Fixed window edge burst debugging lab. The limit is 100 requests per minute, but a scraper gets 200 through in about two seconds, right around :59 and :00.
Practice debugging a fixed window edge burst in a live, broken production system in your browser, with Redis. Find the root cause in the logs, terminal and code, fix it, and a load test checks that the fix holds under real traffic.
1. The Incident Context
The rate limit is 100 requests per minute per client. A scraper is getting 200 requests through in about two seconds, every time, right around the minute boundary. The counters never exceed 100 in any single minute.
2. Observed Symptoms & Metrics
- Affected Endpoints / Components:
GET /api, the rate limiter, Redis.
- Behavior: Send 100 requests at 10:00:59 and 100 at 10:01:00. Both minutes are under the limit, but 200 requests slipped through in one second.
- Error Rate: The limiter returns 429 as expected once a minute's counter passes 100; the problem is the two windows don't see each other.
- System Metrics: Redis shows one counter key per client per minute, each expiring shortly after.
3. Application Logs
10:00:59 client=scraper window=600 count=100
10:01:00 client=scraper window=601 count=100
10:01:01 client=scraper served 200 requests across the window edge
4. Your Objective
Step into the live environment while synthetic traffic is running, diagnose the root cause, and patch the codebase.
To clear this stack, your fix must satisfy this automated verification check:
- Window edge: A client that fires 100 requests just before a minute boundary and 100 just after gets no more than 110 through.
Toolbox: curl -H 'X-Client-Id: me' localhost:8080/api, redis-cli keys 'rl:*', redis-cli get rl:me:<minute>, the app logs.
A fixed-window counter resets to zero at :00. Weight the previous window by how much of it still overlaps the current minute.
Save a file in the editor to rebuild and restart the app. Click Verify when you think it's fixed.
Your account and data
You can browse stacks without an account. To run labs you sign in with your email or Google account. BustedStack uses your email address to
sign you in, and your name and profile picture to show your account and pre-fill certificates. We never access your Gmail, contacts or Drive,
sell your data or run ad trackers.
Privacy Policy · Terms of Service · Browse stacks ·
hello@bustedstack.com
This site needs JavaScript to run labs.