模块 ngx_http_split_clients_module

示例配置
Directives
split_clients

该模块创建 适用于 A/B 测试的变量,也称为拆分测试。ngx_http_split_clients_module

示例配置

http {
    split_clients "${remote_addr}AAA" $variant {
                   0.5%               .one;
                   2.0%               .two;
                   *                  "";
    }

    server {
        location / {
            index index${variant}.html;

Directives

语法: split_clients string $variable { ... }
默认值:
上下文: http

为 A/B 测试创建变量,例如:

split_clients "${remote_addr}AAA" $variant {
               0.5%               .one;
               2.0%               .two;
               *                  "";
}

原始字符串的值使用 MurmurHash2 进行哈希处理。 在给定的示例中,哈希值从 0 到 21474835 (0.5%) 对应于 变量的值, 从 21474836 到 107374180 的哈希值 (2%) 对应于 值 , 以及从 107374181 到 4294967295 对应的哈希值 值 (空字符串)。".one"$variant".two"""