What is the round-robin method in nginx load balancing?
Round-robin is the default load balancing method in nginx. It distributes incoming requests evenly across all backend servers in a repeating order, like taking turns.
Click to reveal answer
beginner
How does nginx decide which server to send a request to when using round-robin?
Nginx sends each new request to the next server in the list, cycling back to the first server after reaching the last one.
Click to reveal answer
intermediate
Show a simple nginx configuration snippet using round-robin load balancing.
upstream backend {
server backend1.example.com;
server backend2.example.com;
}
server {
location / {
proxy_pass http://backend;
}
}
Click to reveal answer
beginner
Why is round-robin load balancing useful?
It spreads the workload evenly across servers, preventing any single server from getting too busy and improving overall performance.
Click to reveal answer
intermediate
What happens if one backend server is slow or down in a round-robin setup?
Nginx will still send requests to that server unless health checks or failover are configured. This can cause delays or errors for users.
Click to reveal answer
What is the default load balancing method in nginx?
ARound-robin
BLeast connections
CIP hash
DRandom
✗ Incorrect
Nginx uses round-robin as the default method, sending requests evenly in order to backend servers.
In round-robin load balancing, how does nginx choose the next server?
ARandomly picks any server
BChooses the server with least load
CAlways picks the first server
DCycles through servers in order
✗ Incorrect
Round-robin cycles through servers one by one, repeating the sequence.
Which nginx directive defines the group of backend servers for load balancing?
Aupstream {}
Bproxy_pass {}
Clocation {}
Dserver {}
✗ Incorrect
The 'upstream' block lists backend servers for load balancing.
What is a limitation of round-robin without health checks?
AIt never balances load
BIt only uses one server
CIt can send requests to down servers
DIt requires manual server selection
✗ Incorrect
Without health checks, nginx may send requests to servers that are down or slow.
How can you improve round-robin load balancing to avoid sending requests to unhealthy servers?
AUse IP hash method
BConfigure health checks and failover
CDisable load balancing
DUse random load balancing
✗ Incorrect
Health checks help nginx detect unhealthy servers and skip them.
Explain how round-robin load balancing works in nginx and why it is useful.
Think about taking turns to share work fairly.
You got /4 concepts.
Describe a simple nginx configuration to set up round-robin load balancing with two backend servers.
Focus on how to list servers and connect them to the proxy.
You got /4 concepts.
Practice
(1/5)
1. What does the default round-robin method in nginx do when balancing requests?
easy
A. It sends requests based on server load automatically.
B. It sends all requests to the first server until it fails.
C. It sends requests randomly to any server.
D. It sends each new request to the next server in the list, cycling through them.
Solution
Step 1: Understand round-robin behavior in nginx
Round-robin means distributing requests evenly by cycling through servers one by one.
Step 2: Match behavior to options
Only It sends each new request to the next server in the list, cycling through them. describes cycling through servers for each new request.
Final Answer:
It sends each new request to the next server in the list, cycling through them. -> Option D
Quick Check:
Round-robin = cycling requests evenly [OK]
Hint: Round-robin cycles through servers one by one [OK]
Common Mistakes:
Thinking round-robin sends all requests to one server
Confusing round-robin with random or load-based methods
Assuming round-robin skips servers
2. Which of the following is the correct syntax to define a round-robin upstream block in nginx?
easy
A. upstream backend { round_robin; server server1; server server2; }
B. upstream backend { server server1.example.com; server server2.example.com; }
C. upstream backend { server server1; server server2; load_balance round_robin; }
D. upstream backend { server server1; server server2; balance round_robin; }
Solution
Step 1: Recall nginx upstream syntax
The default round-robin method requires only listing servers inside an upstream block without extra keywords.
Step 2: Check each option for correctness
upstream backend { server server1.example.com; server server2.example.com; } correctly lists servers simply. Options B, C, and D use invalid or unsupported directives.
Final Answer:
upstream backend { server server1.example.com; server server2.example.com; } -> Option B
Quick Check:
Default round-robin needs only server list [OK]
Hint: Round-robin needs only server list, no extra keywords [OK]
Common Mistakes:
Adding unsupported directives like round_robin or balance
Using incorrect keywords inside upstream block
Forgetting semicolons after server lines
3. Given this nginx upstream configuration:
upstream backend {
server server1.example.com;
server server2.example.com;
server server3.example.com;
}
What server will handle the 5th incoming request?
medium
A. server2.example.com
B. server1.example.com
C. server3.example.com
D. Depends on server load
Solution
Step 1: Understand round-robin cycling through servers
Requests are sent in order: 1->server1, 2->server2, 3->server3, then cycle repeats.
Step 2: Calculate 5th request server
Requests 4 and 5 cycle back: 4->server1, 5->server2.
Final Answer:
server2.example.com -> Option A
Quick Check:
5 mod 3 = 2, so server2 handles 5th request [OK]
Hint: Count requests modulo server count to find server [OK]
Common Mistakes:
Assuming 5th request goes to server3
Thinking load affects round-robin by default
Starting count from zero instead of one
4. You configured nginx upstream with:
upstream backend {
server server1.example.com;
server server2.example.com;
server server3.example.com down;
}
But requests are still sent to server3.example.com. What is the likely problem?
medium
A. The 'down' parameter is misspelled or misplaced.
B. Nginx does not support marking servers as down.
C. The 'down' parameter requires a reload, not just restart.
D. The 'down' parameter disables the server only if it is unreachable.
Solution
Step 1: Check correct usage of 'down' parameter
The 'down' flag must be placed immediately after the server address without extra spaces or errors.
Step 2: Identify common syntax mistakes
If 'down' is misspelled or misplaced, nginx ignores it and still sends requests to that server.
Step 3: Understand reload vs restart
Nginx requires a reload (nginx -s reload) to apply config changes like 'down'; a restart may not apply changes immediately.
Final Answer:
The 'down' parameter requires a reload, not just restart. -> Option C
Quick Check:
Reload nginx to apply 'down' flag changes [OK]
Hint: Reload nginx after config changes to apply 'down' flag [OK]
Common Mistakes:
Misspelling 'down' as 'dwon' or 'dnw'
Placing 'down' on a separate line
Not reloading nginx after config change
5. You want to ensure nginx sends requests evenly to three servers but skip one server temporarily without removing it from config. Which is the best way to do this using round-robin?
hard
A. Mark the server as 'down' in the upstream block to skip it.
B. Remove the server line from the upstream block temporarily.
C. Add 'weight=0' to the server to disable it.
D. Use 'max_fails=0' to prevent requests to that server.
Solution
Step 1: Understand how to skip a server temporarily
Marking a server as 'down' tells nginx to skip it without removing it from config.
Step 2: Evaluate other options
Removing the server line is permanent. 'weight=0' is invalid syntax. 'max_fails=0' disables failure detection but not requests.
Final Answer:
Mark the server as 'down' in the upstream block to skip it. -> Option A
Quick Check:
'down' flag skips server temporarily [OK]
Hint: Use 'down' flag to skip server without removing it [OK]
Common Mistakes:
Removing server line instead of marking down
Using invalid 'weight=0' syntax
Confusing max_fails with disabling server
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.