ngx_http_split_clients_module 模块创建适合 A/B 测试的变量,也称为拆分测试。
http {
split_clients "${remote_addr}AAA" $variant {
0.5% .one;
2.0% .two;
* "";
}
server {
location / {
index index${variant}.html;
}
}]
}语 法:split_clients string $variable { ... }
默认值:—
上下文:http为 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”,而 hash 从 107374181 到 4294967295 的值对应于值“”(空字符串)。