Nginx/Nginx 모듈 학습

ngx_http_split_clients_module 모듈

hippo 데브옵스 2023. 9. 22. 02:52
 

Module ngx_http_split_clients_module

Module ngx_http_split_clients_module The ngx_http_split_clients_module module creates variables suitable for A/B testing, also known as split testing. Example Configuration http { split_clients "${remote_addr}AAA" $variant { 0.5% .one; 2.0% .two; * ""; } s

nginx.org

 

  • ngx_http_split_clients_module 모듈은 분할 테스트라고도 하는 A/B 테스트에 적합한 변수를 생성함

 

split_clients 지시자

  • 구성 예시
    http {
        split_clients "${remote_addr}AAA" $variant {
                       0.5%               .one;
                       2.0%               .two;
                       *                  "";
        }
        server {
            location / {
                index index${variant}.html;
            }
        }
     }
  • original 문자열의 값은 MurmurHash2를 사용하여 해시

  • 예시)
    • 0에서 21474835(0.5%)의 해시 값은 $variant 변수의 값 ".one"에 해당
    • 21474836에서 107374180(2%)의 해시 값은 ".two"에 해당
    • 107374181에서 4294967295의 해시 값은 ""(빈 문자열)에 해당

  • 문맥 : http
  • 사용 문법
    ## 문법
    split_clients string $variable { ... }