0
0
Nginxdevops~10 mins

Why load balancing distributes traffic in Nginx - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to define a basic load balancer using NGINX.

Nginx
upstream backend {
    server [1];
}

server {
    listen 80;
    location / {
        proxy_pass http://backend;
    }
}
Drag options to blanks, or click blank then click option'
Alocalhost:8080
B192.168.1.1:80
C127.0.0.1:8080
Dexample.com:80
Attempts:
3 left
💡 Hint
Common Mistakes
Using domain names without ports
Using IP without port
Using invalid IP addresses
2fill in blank
medium

Complete the code to set the load balancing method to round robin.

Nginx
upstream backend {
    # [1];
    server 127.0.0.1:8080;
    server 127.0.0.1:8081;
}
Drag options to blanks, or click blank then click option'
Around_robin
Bip_hash
Cleast_conn
Dweight
Attempts:
3 left
💡 Hint
Common Mistakes
Choosing 'least_conn' or 'ip_hash' which are different methods
Using 'weight' which is not a method directive
3fill in blank
hard

Fix the error in the load balancer configuration to enable sticky sessions.

Nginx
upstream backend {
    [1];
    server 192.168.0.10;
    server 192.168.0.11;
}
Drag options to blanks, or click blank then click option'
Aleast_conn
Bip_hash
Cround_robin
Dsticky
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'sticky' which is not a valid directive in standard NGINX
Using 'round_robin' which does not guarantee sticky sessions
4fill in blank
hard

Fill both blanks to configure weighted load balancing for two servers.

Nginx
upstream backend {
    server 10.0.0.1 weight=[1];
    server 10.0.0.2 weight=[2];
}
Drag options to blanks, or click blank then click option'
A3
B1
C5
D0
Attempts:
3 left
💡 Hint
Common Mistakes
Using zero weight which disables the server
Using equal weights which does not show weighted distribution
5fill in blank
hard

Fill all three blanks to create a health check for backend servers.

Nginx
server {
    listen 80;
    location / {
        proxy_pass http://backend;
        proxy_next_upstream [1];
        proxy_connect_timeout [2]s;
        proxy_read_timeout [3]s;
    }
}
Drag options to blanks, or click blank then click option'
Aerror timeout invalid_header
B5
C10
Doff
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'off' disables retries
Using zero or negative timeouts causes errors