F5 GTM ratio(比例)算法决策机制

4 篇文章 0 订阅

在使用ratio算法的过程中,发现修改比例以后,结果没有很快体现出来。查了一下官方的文档,说修改比例以后,会存在明显的延迟。于是对GTM的比例算法进行了一些测试。

1、比例1:1测试

配置如下:
域名为:www.test.com
域名下面共两个地址,配置首选算法为ratio,比例为1:1
在这里插入图片描述

使用脚本测试,可以看到此时的结果为两个地址轮询

while true; do dig www.test.com @10.1.10.240 +short ;done
10.1.10.21
10.1.10.20
10.1.10.21
10.1.10.20
10.1.10.21
10.1.10.20
10.1.10.21
10.1.10.20
10.1.10.21
10.1.10.20
10.1.10.21
10.1.10.20
10.1.10.21
10.1.10.20
10.1.10.21
10.1.10.20

2、修改比例

在这里插入图片描述
可以看到将其中一个的比例修改为80以后,结果马上生效了

while true; do dig www.test.com @10.1.10.240 +short ;done
10.1.10.21
10.1.10.21
10.1.10.21
10.1.10.21
10.1.10.21
10.1.10.21
10.1.10.21
10.1.10.21
10.1.10.21
10.1.10.21
10.1.10.21
10.1.10.21
10.1.10.21
10.1.10.21

3、

继续修改另一个成员的比例为20
在这里插入图片描述

查看决策日志,可以发现,每一次请求到达以后ratio counter减1,并且优先使用比例值较大的成员,当减到两个成员的ratio counter计数器相同时,开始进行轮询。

Dec  8 00:12:58 bigip1 info tmm[17565]: 2023-12-08 00:12:57 bigip1 qid 42285 from 10.1.10.1#61527 [www.test.com A] [pool member check succeeded (10.1.10.20:10.1.10.20) - pool member state is available (green)] [ratio selected pool member (10.1.10.20:10.1.10.20) - ratio counter (20) is higher] [pool member check succeeded (10.1.10.21:10.1.10.21) - pool member state is available (green)] [ratio selected pool member (10.1.10.21:10.1.10.21) - ratio counter (69) is higher] [ratio selected pool member (10.1.10.21:10.1.10.21) with the first highest ratio counter (69)] [ratio selected pool member (10.1.10.21:10.1.10.21)]
Dec  8 00:12:58 bigip1 info tmm[17565]: 2023-12-08 00:12:57 bigip1 qid 63003 from 10.1.10.1#61528: view none: query: www.test.com IN A +E (10.1.10.240%0)
Dec  8 00:12:58 bigip1 info tmm[17565]: 2023-12-08 00:12:57 bigip1 qid 63003 from 10.1.10.1#61528 [www.test.com A] [pool member check succeeded (10.1.10.20:10.1.10.20) - pool member state is available (green)] [ratio selected pool member (10.1.10.20:10.1.10.20) - ratio counter (20) is higher] [pool member check succeeded (10.1.10.21:10.1.10.21) - pool member state is available (green)] [ratio selected pool member (10.1.10.21:10.1.10.21) - ratio counter (68) is higher] [ratio selected pool member (10.1.10.21:10.1.10.21) with the first highest ratio counter (68)] [ratio selected pool member (10.1.10.21:10.1.10.21)]
Dec  8 00:12:58 bigip1 info tmm[17565]: 2023-12-08 00:12:57 bigip1 qid 14637 from 10.1.10.1#61529: view none: query: www.test.com IN A +E (10.1.10.240%0)
Dec  8 00:12:58 bigip1 info tmm[17565]: 2023-12-08 00:12:57 bigip1 qid 14637 from 10.1.10.1#61529 [www.test.com A] [pool member check succeeded (10.1.10.20:10.1.10.20) - pool member state is available (green)] [ratio selected pool member (10.1.10.20:10.1.10.20) - ratio counter (20) is higher] [pool member check succeeded (10.1.10.21:10.1.10.21) - pool member state is available (green)] [ratio selected pool member (10.1.10.21:10.1.10.21) - ratio counter (67) is higher] [ratio selected pool member (10.1.10.21:10.1.10.21) with the first highest ratio counter (67)] [ratio selected pool member (10.1.10.21:10.1.10.21)]
Dec  8 00:12:58 bigip1 info tmm[17565]: 2023-12-08 00:12:58 bigip1 qid 40202 from 10.1.10.1#54964: view none: query: www.test.com IN A +E (10.1.10.240%0)
Dec  8 00:12:58 bigip1 info tmm[17565]: 2023-12-08 00:12:58 bigip1 qid 40202 from 10.1.10.1#54964 [www.test.com A] [pool member check succeeded (10.1.10.20:10.1.10.20) - pool member state is available (green)] [ratio selected pool member (10.1.10.20:10.1.10.20) - ratio counter (20) is higher] [pool member check succeeded (10.1.10.21:10.1.10.21) - pool member state is available (green)] [ratio selected pool member (10.1.10.21:10.1.10.21) - ratio counter (66) is higher] [ratio selected pool member (10.1.10.21:10.1.10.21) with the first highest ratio counter (66)] [ratio selected pool member (10.1.10.21:10.1.10.21)]

Dec  8 00:13:04 bigip1 info tmm[17565]: 2023-12-08 00:13:03 bigip1 qid 58171 from 10.1.10.1#54672 [www.test.com A] [pool member check succeeded (10.1.10.20:10.1.10.20) - pool member state is available (green)] [ratio selected pool member (10.1.10.20:10.1.10.20) - ratio counter (18) is higher] [pool member check succeeded (10.1.10.21:10.1.10.21) - pool member state is available (green)] [ratio skipped pool member (10.1.10.21:10.1.10.21) - ratio counter (18) is not higher] [ratio selected pool member (10.1.10.20:10.1.10.20) with the first highest ratio counter (18)] [ratio selected pool member (10.1.10.20:10.1.10.20)]
Dec  8 00:13:04 bigip1 info tmm[17565]: 2023-12-08 00:13:03 bigip1 qid 49377 from 10.1.10.1#54673: view none: query: www.test.com IN A +E (10.1.10.240%0)
Dec  8 00:13:04 bigip1 info tmm[17565]: 2023-12-08 00:13:03 bigip1 qid 49377 from 10.1.10.1#54673 [www.test.com A] [pool member check succeeded (10.1.10.20:10.1.10.20) - pool member state is available (green)] [ratio selected pool member (10.1.10.20:10.1.10.20) - ratio counter (17) is higher] [pool member check succeeded (10.1.10.21:10.1.10.21) - pool member state is available (green)] [ratio selected pool member (10.1.10.21:10.1.10.21) - ratio counter (18) is higher] [ratio selected pool member (10.1.10.21:10.1.10.21) with the first highest ratio counter (18)] [ratio selected pool member (10.1.10.21:10.1.10.21)]
Dec  8 00:13:04 bigip1 info tmm[17565]: 2023-12-08 00:13:03 bigip1 qid 17609 from 10.1.10.1#54674: view none: query: www.test.com IN A +E (10.1.10.240%0)
Dec  8 00:13:04 bigip1 info tmm[17565]: 2023-12-08 00:13:03 bigip1 qid 17609 from 10.1.10.1#54674 [www.test.com A] [pool member check succeeded (10.1.10.20:10.1.10.20) - pool member state is available (green)] [ratio selected pool member (10.1.10.20:10.1.10.20) - ratio counter (17) is higher] [pool member check succeeded (10.1.10.21:10.1.10.21) - pool member state is available (green)] [ratio skipped pool member (10.1.10.21:10.1.10.21) - ratio counter (17) is not higher] [ratio selected pool member (10.1.10.20:10.1.10.20) with the first highest ratio counter (17)] [ratio selected pool member (10.1.10.20:10.1.10.20)]
Dec  8 00:13:04 bigip1 info tmm[17565]: 2023-12-08 00:13:03 bigip1 qid 54376 from 10.1.10.1#54675: view none: query: www.test.com IN A +E (10.1.10.240%0)
Dec  8 00:13:04 bigip1 info tmm[17565]: 2023-12-08 00:13:03 bigip1 qid 54376 from 10.1.10.1#54675 [www.test.com A] [pool member check succeeded (10.1.10.20:10.1.10.20) - pool member state is available (green)] [ratio selected pool member (10.1.10.20:10.1.10.20) - ratio counter (16) is higher] [pool member check succeeded (10.1.10.21:10.1.10.21) - pool member state is available (green)] [ratio selected pool member (10.1.10.21:10.1.10.21) - ratio counter (17) is higher] [ratio selected pool member (10.1.10.21:10.1.10.21) with the first highest ratio counter (17)] [ratio selected pool member (10.1.10.21:10.1.10.21)]
Dec  8 00:13:04 bigip1 info tmm[17565]: 2023-12-08 00:13:03 bigip1 qid 14681 from 10.1.10.1#54676: view none: query: www.test.com IN A +E (10.1.10.240%0)
Dec  8 00:13:04 bigip1 info tmm[17565]: 2023-12-08 00:13:03 bigip1 qid 14681 from 10.1.10.1#54676 [www.test.com A] [pool member check succeeded (10.1.10.20:10.1.10.20) - pool member state is available (green)] [ratio selected pool member (10.1.10.20:10.1.10.20) - ratio counter (16) is higher] [pool member check succeeded (10.1.10.21:10.1.10.21) - pool member state is available (green)] [ratio skipped pool member (10.1.10.21:10.1.10.21) - ratio counter (16) is not higher] [ratio selected pool member (10.1.10.20:10.1.10.20) with the first highest ratio counter (16)] [ratio selected pool member (10.1.10.20:10.1.10.20)]

4、总结

在使用比例算法时,如果DNS请求量较小,或者对短期的效果要求较高,建议使用较小的数字作为比例,比如10:20。不要使用数字0作为比例,如果你不想给某个成员分配流量,可以直接将其禁用。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值