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; } }
文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-ngx_http_split_clients_module/
IP地址加上AAA字符串会使用MurmurHash2转换成数字。得出的数字在前0.5%,那么$variant值为.one,相应的在0.5-2.0%区间的值为.two,其他的为空字符。文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-ngx_http_split_clients_module/
split_clients指令
语法:split_clients string $variable { ... }
默认值: —
配置段: http文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-ngx_http_split_clients_module/
原始字符串的值经过MurmurHash2算法进行了哈希。 示例中,哈希值从0到21474835(0.5%)对应于变量$variant
的".one"
值, 哈希值从21474836到107374180(2%)对应于值".two"
, 哈希值从107374181到4294967295对应于值""
(一个空字符串)。文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-ngx_http_split_clients_module/
文章源自运维生存时间-https://www.ttlsa.com/nginx/nginx-ngx_http_split_clients_module/

2F
像移动这样共享上网的用户,是不是会出现有时看到,有时看不到的情况
B1
@ laughingman 有可能
1F
感谢分享。虽然还不知道怎么用。