Ribbion负载均衡源码

主要还是通过以下三个链接了解了负载均衡的源码,自我总结如下:

客户端负载均衡

LoadBalancerAutoConfiguration类里使用RestTemplateCustomizer对所有标注了@LoadBalancer的RestTemplate Bean添加了一个LoadBalancerInterceptor拦截器。

LoadBalancerInterceptor会去RestTemplate的请求进行拦截,然后从eureka中获取服务id与端口号,随后利用负载均衡算法得到真实的服务地址信息,替换服务id。

LoadBalancerClient的execute()方法 

https://mbd.baidu.com/ug_share/mbox/4a83aa9e65/share?product=smartapp&tk=4553173e8bb1e575db297845296ae76e&share_url=https%3A%2F%2Fyebd1h.smartapps.cn%2Fpages%2Fblog%2Findex%3FblogId%3D125984753%26_swebfr%3D1%26_swebFromHost%3Dbaiduboxapp&domain=mbd.baidu.com

Ribbon 负载均衡源码解读 - 香吧香 - 博客园 

https://mbd.baidu.com/ug_share/mbox/4a83aa9e65/share?product=smartapp&tk=00e2bb56e7112354486e2a641ce6e702&share_url=https%3A%2F%2Fyebd1h.smartapps.cn%2Fpages%2Fblog%2Findex%3FblogId%3D108396680%26_swebfr%3D1%26_swebFromHost%3Dbaiduboxapp&domain=mbd.baidu.com 

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值