Module ngx_http_split_clients_module

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

Example Configuration

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

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

Directives

Syntax:split_clients string $variable { ... }
Default:
Context: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",哈希值从 107374181 到 4294967295 值""(空字符串)。