ngx_http_split_clients_module 模块

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 指令

语 法: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 的值对应于值“”(空字符串)。

说说我的看法
全部评论(
没有评论
关于
本网站属于个人的非赢利性网站,转载的文章遵循原作者的版权声明,如果原文没有版权声明,请来信告知:hxstrive@outlook.com
公众号