0
0
Nginxdevops~5 mins

Weighted round-robin in Nginx - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is weighted round-robin in nginx?
Weighted round-robin is a load balancing method in nginx that distributes client requests to servers based on assigned weights, sending more requests to servers with higher weights.
Click to reveal answer
beginner
How do you assign weights to servers in nginx configuration for weighted round-robin?
You assign weights by adding the 'weight' parameter to each server in the upstream block, like: server 192.168.1.1 weight=3; which means this server gets 3 times more requests than a server with weight=1.
Click to reveal answer
beginner
Example of an nginx upstream block using weighted round-robin?
upstream backend { server 192.168.1.1 weight=3; server 192.168.1.2 weight=1; } This sends 3 requests to 192.168.1.1 for every 1 request to 192.168.1.2.
Click to reveal answer
intermediate
Why use weighted round-robin instead of simple round-robin?
Weighted round-robin lets you send more traffic to stronger or faster servers by assigning higher weights, improving performance and resource use compared to simple round-robin which treats all servers equally.
Click to reveal answer
beginner
What happens if all servers have the same weight in nginx weighted round-robin?
If all servers have the same weight, weighted round-robin behaves like simple round-robin, distributing requests evenly across all servers.
Click to reveal answer
In nginx weighted round-robin, what does a higher weight mean for a server?
AIt receives more client requests
BIt receives fewer client requests
CIt is ignored by nginx
DIt becomes a backup server
How do you specify a server with weight 5 in nginx upstream configuration?
Aserver 192.168.1.1 count=5;
Bserver 192.168.1.1 priority=5;
Cserver 192.168.1.1 load=5;
Dserver 192.168.1.1 weight=5;
What load balancing method does nginx use if weights are not specified?
AIP hash
BLeast connections
CSimple round-robin
DRandom
If server A has weight 4 and server B has weight 1, how many requests does server A get for every request to server B?
A4
B1
C5
D0.25
Which nginx directive block contains the weighted round-robin server definitions?
Alocation
Bupstream
Cserver
Dhttp
Explain how weighted round-robin works in nginx and why it might be useful.
Think about sending more work to stronger servers.
You got /3 concepts.
    Write a simple nginx upstream configuration using weighted round-robin with two servers, one with weight 2 and the other with weight 1.
    Use 'server IP weight=number;' inside upstream.
    You got /4 concepts.