0
0
Nginxdevops~10 mins

Performance bottleneck identification in Nginx - Interactive Code Practice

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

Complete the code to check the current active connections in NGINX.

Nginx
curl http://localhost/nginx_status | grep [1]
Drag options to blanks, or click blank then click option'
AActive
BConnections
CRequests
DStatus
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'Connections' alone does not match the exact line.
Using 'Requests' shows total requests, not active connections.
2fill in blank
medium

Complete the code to enable the stub_status module in NGINX configuration.

Nginx
location /nginx_status {
    stub_status [1];
    allow 127.0.0.1;
    deny all;
}
Drag options to blanks, or click blank then click option'
Aon
Boff
Cenable
Dtrue
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'off' disables the module.
Using 'enable' or 'true' are invalid directives.
3fill in blank
hard

Fix the error in the NGINX log format to include request time.

Nginx
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                 '$status $body_bytes_sent "$http_referer" '
                 '"$http_user_agent" $[1]; 
Drag options to blanks, or click blank then click option'
Arequest_length_time
Brequest_time
Crequest_length
Drequest_duration
Attempts:
3 left
💡 Hint
Common Mistakes
Using '$request_duration' or '$request_length' are invalid variables.
Misspelling the variable causes logging errors.
4fill in blank
hard

Fill both blanks to create a map that sets a variable based on request time threshold.

Nginx
map $request_time $slow_request {
    default [1];
    ~^[3-9]\.|^[1-9][0-9]+ [2];
}
Drag options to blanks, or click blank then click option'
A0
B1
Ctrue
Dfalse
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'true' or 'false' instead of numeric 0 or 1.
Reversing the default and matched values.
5fill in blank
hard

Fill all three blanks to log slow requests only.

Nginx
access_log /var/log/nginx/slow.log combined if=[1];

map $request_time $slow_request {
    default [2];
    ~^[3-9]\.|^[1-9][0-9]+ [3];
}
Drag options to blanks, or click blank then click option'
A$slow_request
B0
C1
D$request_time
Attempts:
3 left
💡 Hint
Common Mistakes
Using '$request_time' directly in access_log condition.
Mixing up default and matched values in the map.