What does the burst option do in nginx rate limiting?
The burst option allows a temporary extra number of requests to pass beyond the set rate limit. It acts like a small buffer for sudden spikes in traffic.
Click to reveal answer
beginner
Explain the nodelay option in nginx rate limiting.
The nodelay option lets requests in the burst queue pass immediately without delay. Without it, requests in the burst queue are delayed to match the rate limit.
Click to reveal answer
intermediate
How do burst and nodelay work together in nginx?
The burst option allows extra requests to queue up temporarily. The nodelay option makes those queued requests pass instantly instead of waiting, helping handle sudden traffic bursts smoothly.
Click to reveal answer
intermediate
What happens if you set burst without nodelay in nginx?
Requests above the rate limit are queued up to the burst size but are delayed to match the rate limit speed. This can cause some requests to wait before being processed.
Click to reveal answer
beginner
Give a simple nginx configuration snippet using burst and nodelay.
Hint: Add nodelay to process burst requests immediately [OK]
Common Mistakes:
Assuming burst alone allows immediate processing
Thinking burst must be less than 5
Believing multiple restarts fix config issues
5. You want to handle sudden spikes of up to 20 extra requests per second without delay, but reject any beyond that. Which nginx config snippet achieves this?
hard
A. limit_req_zone $binary_remote_addr zone=spike:10m rate=20r/s;
limit_req zone=spike burst=5 nodelay;
B. limit_req_zone $binary_remote_addr zone=spike:10m rate=25r/s;
limit_req zone=spike burst=0;
C. limit_req_zone $binary_remote_addr zone=spike:10m rate=5r/s;
limit_req zone=spike burst=0 nodelay;
D. limit_req_zone $binary_remote_addr zone=spike:10m rate=5r/s;
limit_req zone=spike burst=20 nodelay;
Solution
Step 1: Set base rate and burst for spikes
The base rate is 5 requests per second, and burst=20 allows 20 extra requests queued.
Step 2: Use nodelay to process burst immediately
Adding nodelay ensures the burst requests are processed right away without delay.
Step 3: Confirm rejection beyond burst
Requests beyond burst=20 will be rejected, matching the requirement.