On this page
Module ngx_stream_split_clients_module
ngx_stream_split_clients_module
模块(1.11.3)创建适用于 A/B 测试(也称为拆分测试)的变量。
Example Configuration
stream {
...
split_clients "${remote_addr}AAA" $upstream {
0.5% feature_test1;
2.0% feature_test2;
* production;
}
server {
...
proxy_pass $upstream;
}
}
Directives
Syntax: | split_clients string $variable { ... } |
Default: | — |
Context: | stream |
创建用于 A/B 测试的变量,例如:
split_clients "${remote_addr}AAA" $variant {
0.5% .one;
2.0% .two;
* "";
}
原始字符串的值使用 MurmurHash2 进行哈希处理。在给定的示例中,哈希值从 0 到 21474835(0.5%)对应于$variant
变量的值".one"
,哈希值从 21474836 到 107374180(2%)对应于值".two"
,哈希值从 107374181 到 4294967295 值""
(空字符串)。