0
0
Nginxdevops~5 mins

Least connections in Nginx - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What does the 'least connections' load balancing method do in NGINX?
It sends new requests to the server with the fewest active connections, helping to balance load evenly.
Click to reveal answer
beginner
How do you enable 'least connections' load balancing in NGINX?
Use the directive least_conn; inside the upstream block.
Click to reveal answer
intermediate
Why might 'least connections' be better than 'round robin' in some cases?
Because it considers current load on servers, sending traffic to the least busy server rather than cycling evenly.
Click to reveal answer
beginner
Write a simple NGINX upstream block using 'least connections' for two backend servers.
upstream backend {
    least_conn;
    server backend1.example.com;
    server backend2.example.com;
}
Click to reveal answer
intermediate
What happens if all backend servers have the same number of active connections in 'least connections' mode?
NGINX will choose one of them, usually the first in the list, since they are equally loaded.
Click to reveal answer
What directive enables 'least connections' load balancing in NGINX?
Aleast_conn;
Bround_robin;
Cip_hash;
Drandom;
In 'least connections' mode, NGINX sends new requests to:
AServers in a fixed order
BThe server with the fewest active connections
CRandomly selected server
DThe server with the highest CPU usage
Which scenario benefits most from 'least connections' load balancing?
AWhen only one backend server is used
BWhen all requests take the same time
CWhen servers are offline
DWhen requests have very different processing times
If two servers have equal active connections, how does NGINX choose in 'least connections' mode?
ARefuses the request
BChooses randomly
CChooses the first server listed
DChooses the last server listed
Which of these is NOT a valid load balancing method in NGINX?
Acpu_load
Bround_robin
Cip_hash
Dleast_conn
Explain how the 'least connections' load balancing method works in NGINX and when it is useful.
Think about how NGINX decides which server to pick based on current load.
You got /3 concepts.
    Describe how to configure 'least connections' load balancing in an NGINX upstream block.
    Look at the syntax inside the upstream block.
    You got /3 concepts.