SpringCloud 8 Ribbon负载均衡服务调用

    科技2022-07-15  120

    SpringCloud 8 Ribbon负载均衡服务调用

    一 概述

    二、官网资料 https://github.com/Netflix/ribbon/wiki/Getting-Started

    1、Ribbon目前也进入维护模式 2、未来替换方案

    三、能干嘛

    1、LB(负载均衡) 2、区别 集中式LB

    进程内LB

    总结: 负载均衡+RestTemplate调用

    四、Ribbon负载均衡演示

    1、架构说明

    2、POM 3、RestTemplate的使用

    官网: https://docs.spring.io/spring-framework/docs/5.2.2.RELEASE/javadoc-api/org/springframework/web/client/RestTemplate.html

    getForObject方法/getForEntity方法 postForObject/postForEntity

    五、Ribbon核心组件IRule

    IRule:根据特定算法从服务列表中选取一个要访问的服务

    六、Ribbon负载均衡算法

    建议:学习RoundRobinRule源码

    Processed: 0.008, SQL: 8