模块 ngx_http_split_clients_module
| Example Configuration Directives split_clients |
该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
|
|---|---|
| 默认: | — |
| 语境: |
http |
创建用于 A/B 测试的变量,例如:
split_clients "${remote_addr}AAA" $variant {
0.5% .one;
2.0% .two;
* "";
}
原始字符串的值使用 MurmurHash2 进行哈希处理。在给出的示例中,从 0 到 21474835 (0.5%) 的哈希值对应于变量".one"的值$variant,从 21474836 到 107374180 (2%) 的哈希值对应于值".two",从 107374181 到 4294967295 的哈希值对应于值""(空字符串)。
