6

On nginx docs there is an example of split_clients directive:

split_clients "${remote_addr}AAA" $variant {
               0.5%               .one;
               2.0%               .two;
               *                  "";
}

In general I understand how this directive works, but I cannot understand what the purpose of AAA suffix is.

Please help

1 Answer 1

7

"AAA" is just an ordinary string. IP address from $remote_addr variable and string "AAA" are concatenated and hashed into a 32-bit number. In case there are two requests from the same IP, this ensures that the value for the $variant variable will be the same.

3
  • Thank you for the reply. but it is still not clear for me. if we omit AAA suffix, won't we get the same behavior?
    – Oleg
    Nov 22, 2015 at 22:24
  • 4
    Yes, you will get the same behaviour. The string AAA is optional. My guess it that it's shown in the official documentation just to make an example that you can concatenate various variables and strings, as to some people it may be useful.
    – Tubeless
    Nov 22, 2015 at 22:30
  • 4
    @Curious Changing the string AAA to something else, will cause the hashes to be completely different, putting different visitors into the test groups. Nov 23, 2015 at 6:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.