ngx_http_split_clients_module 模組

範例設定
指令
     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%)的雜湊值對應於 $variant 變數的值 ".one",從 21474836 到 107374180(2%)的雜湊值對應於值 ".two",而從 107374181 到 4294967295 的雜湊值對應於值 ""(空字串)。