0
0
Nginxdevops~20 mins

A/B testing with split_clients in Nginx - Practice Problems & Coding Challenges

Choose your learning style9 modes available
Challenge - 5 Problems
🎖️
Split Clients Master
Get all challenges correct to earn this badge!
Test your skills under time pressure!
💻 Command Output
intermediate
1:30remaining
Output of split_clients with 50/50 split
Given the following nginx configuration snippet using split_clients, what is the value of the variable $variant for the client with IP 192.168.1.10?
Nginx
split_clients "$remote_addr" $variant {
    50%     "A";
    *       "B";
}

# Assume $remote_addr is 192.168.1.10
A"B"
B"A"
C"50%"
D"192.168.1.10"
Attempts:
2 left
💡 Hint
The split_clients directive hashes the input and assigns variants based on percentage ranges.
Configuration
intermediate
1:30remaining
Correct split_clients syntax for 30/70 split
Which of the following nginx split_clients configurations correctly splits traffic into 30% variant "X" and 70% variant "Y"?
A
split_clients "$cookie_user" $group {
    30% "X";
    *   "Y";
}
B
split_clients "$cookie_user" $group {
    70% "X";
    30% "Y";
}
C
split_clients "$cookie_user" $group {
    30% "X";
    70% "Y";
    *   "Z";
}
D
split_clients "$cookie_user" $group {
    30% "X";
    70% "Y";
}
Attempts:
2 left
💡 Hint
Percentages must add up to 100%, and the wildcard * covers the rest.
Troubleshoot
advanced
2:00remaining
Why does split_clients always assign the same variant?
An nginx config uses split_clients "$http_user_agent" $variant but all users get assigned variant "A" even though the split is 50/50. What is the most likely cause?
Nginx
split_clients "$http_user_agent" $variant {
    50% "A";
    *    "B";
}
AThe split_clients directive does not support string variables like $http_user_agent.
BThe split_clients directive requires $remote_addr, not $http_user_agent.
CThe percentages must be reversed to 50% "B" and * "A".
DThe $http_user_agent variable is empty or identical for all users, causing the hash to always fall in the first bucket.
Attempts:
2 left
💡 Hint
Check what value is being hashed by split_clients.
🔀 Workflow
advanced
2:30remaining
Order of directives for A/B testing with split_clients
What is the correct order of nginx directives to implement A/B testing using split_clients and setting a cookie for persistent variant assignment?
A3,1,2,4
B1,3,2,4
C3,2,1,4
D2,3,1,4
Attempts:
2 left
💡 Hint
You must extract the cookie first, then split, then set cookie if missing.
Best Practice
expert
3:00remaining
Best practice for consistent A/B testing with split_clients
Which approach ensures consistent user experience in nginx A/B testing using split_clients across multiple sessions?
AUse <code>split_clients</code> on <code>$remote_addr</code> only, without cookies.
BUse <code>split_clients</code> on <code>$http_user_agent</code> to vary variants by browser type.
CUse <code>split_clients</code> on a cookie value, and set the cookie if missing to persist variant.
DUse <code>split_clients</code> with random variable to assign variant on each request.
Attempts:
2 left
💡 Hint
Persistence across sessions requires storing variant in a cookie.