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

Oleg
  • 266
  • 3
  • 17

1 Answers1

6

"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.

Tubeless
  • 1,492
  • 13
  • 15
  • 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 '15 at 22:24
  • 3
    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 '15 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. – Michael Hampton Nov 23 '15 at 06:03