0
0
Nginxdevops~10 mins

Burst and nodelay options in Nginx - Step-by-Step Execution

Choose your learning style9 modes available
Process Flow - Burst and nodelay options
Request arrives
Check token bucket
Tokens available?
NoQueue request if burst > 0
Queue full?
Allow request
Process request
Next request
Requests check tokens; if none, burst allows queuing; nodelay controls immediate processing of queued requests.
Execution Sample
Nginx
limit_req_zone $binary_remote_addr zone=mylimit:10m rate=1r/s;
limit_req zone=mylimit burst=3 nodelay;

# Requests come in quickly
Limits requests to 1 per second, allows 3 extra bursts, and nodelay sends bursts immediately without delay.
Process Table
StepIncoming Request #Tokens AvailableBurst Queuenodelay EffectAction Taken
1110nodelay onRequest allowed immediately, tokens now 0
2200nodelay onBurst queue used (1), request allowed immediately
3301nodelay onBurst queue used (2), request allowed immediately
4402nodelay onBurst queue used (3), request allowed immediately
5503nodelay onBurst full, request delayed or rejected
661 (refilled)3nodelay onToken refilled, request allowed immediately
7703nodelay onNo tokens, burst full, request delayed or rejected
💡 Requests stop being allowed immediately when burst queue is full and no tokens are available.
Status Tracker
VariableStartAfter 1After 2After 3After 4After 5After 6After 7
Tokens Available10000010
Burst Queue00123333
Key Moments - 3 Insights
Why does the burst queue fill up even when tokens are zero?
Because burst allows extra requests beyond tokens to queue temporarily, as shown in steps 2-4 in the execution_table.
What does nodelay do when burst queue is used?
With nodelay on, queued burst requests are allowed immediately without delay, as seen in steps 2-4 where requests are allowed right away.
What happens when the burst queue is full and no tokens are available?
Requests are delayed or rejected, as shown in step 5 where burst queue is at max and tokens are zero.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution_table at step 3. How many requests are currently in the burst queue?
A3
B1
C2
D0
💡 Hint
Check the 'Burst Queue' column at step 3 in the execution_table.
At which step does the token bucket refill to allow a new request?
AStep 6
BStep 5
CStep 4
DStep 7
💡 Hint
Look at the 'Tokens Available' column for when it changes from 0 to 1.
If nodelay was off, what would happen to burst queued requests?
AThey would be allowed immediately anyway
BThey would be delayed and not allowed immediately
CThey would be rejected immediately
DTokens would refill faster
💡 Hint
Recall nodelay controls immediate processing of burst queued requests as shown in the execution_table.
Concept Snapshot
limit_req_zone defines request rate and token bucket.
limit_req with burst allows extra queued requests beyond tokens.
nodelay sends burst requests immediately without delay.
Without nodelay, burst requests wait for tokens.
Burst queue max size controls how many extra requests can queue.
Requests exceeding burst queue are delayed or rejected.
Full Transcript
This visual execution shows how nginx's limit_req with burst and nodelay options work. Each incoming request checks if tokens are available in the token bucket. If tokens exist, the request is allowed immediately and tokens decrease. If no tokens are available, burst allows extra requests to queue temporarily. When nodelay is on, these burst queued requests are allowed immediately without waiting. The execution table tracks tokens and burst queue size per request. When the burst queue is full and no tokens remain, requests are delayed or rejected. The variable tracker shows tokens and burst queue changes over time. Key moments clarify why burst queue fills and how nodelay affects request handling. The quiz tests understanding of burst queue size, token refill timing, and nodelay behavior. The snapshot summarizes the core nginx rate limiting concepts with burst and nodelay options.