HttpSplitClientsModule
(Difference between revisions)
Willybarro (Talk | contribs) (Add quotes to improve readability. Remove "-" directive as it's not accepted anymore. Overview about how the percentage calculation works. Example of how to add a query string based on split clients.) |
Willybarro (Talk | contribs) m (Murmurhash to Murmurhash2) |
||
| Line 25: | Line 25: | ||
* Keep in mind that if you use a variable like '''${remote_addr}''' (user IP), the hash (and percentage) will always be the same as long as the user/client keep the same IP. In other words, the '''$variant''' value will always be the same for the same IP. | * Keep in mind that if you use a variable like '''${remote_addr}''' (user IP), the hash (and percentage) will always be the same as long as the user/client keep the same IP. In other words, the '''$variant''' value will always be the same for the same IP. | ||
| − | * Hashing algorithm is | + | * Hashing algorithm is MurmurHash2 since version 1.0.1; Previously CRC32. |
== Sending a query string variable to 51% of clients (to PHP scripts) == | == Sending a query string variable to 51% of clients (to PHP scripts) == | ||
Revision as of 17:54, 23 November 2012
Contents |
Synopsis
ngx_http_split_clients_module is used to split clients based on some conditions(e.g ip addresses, headers, cookies, etc).
Examples
Basic configuration:
On the example configuration above, the input for calculating the percentage is the variable plus string ("${remote_addr}AAA"). This string will be converted into a percentage value using MurmurHash2, the result will be compared to the directives and fill the $variant variable with the value just after the percentage in the configuration directives.
Instead of ${remote_addr}, one could use ${cookie}, ${args} or another nginx variable. You may also add a salt (arbitrary string) if needed.
- Keep in mind that if you use a variable like ${remote_addr} (user IP), the hash (and percentage) will always be the same as long as the user/client keep the same IP. In other words, the $variant value will always be the same for the same IP.
- Hashing algorithm is MurmurHash2 since version 1.0.1; Previously CRC32.
Sending a query string variable to 51% of clients (to PHP scripts)
Directives
split_clients
| Syntax: | split_clients string $variable { ... } |
| Default: | |
| Context: | http |
| Reference: | split_clients |










