- A+
所属分类:Nginx
ngx_http_split_clients_module
模块创建适合于A/B测试(也叫做分离测试)的变量。或者当做负载均衡来使用。我相信,有很多地方可以用上此模块。
配置实例
1 2 3 4 5 6 7 8 9 10 11 12 |
http { split_clients "${remote_addr}AAA" $variant { 0.5% .one; 2.0% .two; * ""; } server { location / { index index${variant}.html; } } |
IP地址加上AAA字符串会使用MurmurHash2转换成数字。得出的数字在前0.5%,那么$variant值为.one,相应的在0.5-2.0%区间的值为.two,其他的为空字符。
split_clients指令
语法:split_clients string $variable { ... }
默认值: —
配置段: http
原始字符串的值经过MurmurHash2算法进行了哈希。 示例中,哈希值从0到21474835(0.5%)对应于变量$variant
的".one"
值, 哈希值从21474836到107374180(2%)对应于值".two"
, 哈希值从107374181到4294967295对应于值""
(一个空字符串)。

微信公众号
扫一扫关注运维生存时间公众号,获取最新技术文章~
07/05/2015 上午 10:21 沙发
像移动这样共享上网的用户,是不是会出现有时看到,有时看不到的情况
07/05/2015 下午 7:10 1层
@laughingman 有可能
02/04/2015 下午 5:22 板凳
感谢分享。虽然还不知道怎么用。