LB方案分类

目前主流的LB方案可分成两类:一种是集中式LB, 即在服务的消费方和提供方之间使用独立的LB设施(可以是硬件,如F5, 也可以是软件,如nginx), 由该设施负责把访问请求通过某种策略转发至服务的提供方;另一种是进程内LB,将LB逻辑集成到消费方,消费方从服务注册中心获知有哪些地址可用,然后自己再从这些地址中选择出一个合适的服务器。Ribbon就属于后者,它只是一个类库,集成于消费方进程,消费方通过它来获取到服务提供方的地址。

1. Ribbon是什么?它解决了什么问题?

Ribbon is a client side IPC library that is battle-tested in cloud. It provides the following features

  • Load balancing
  • Fault tolerance
  • Multiple protocol (HTTP, TCP, UDP) support in an asynchronous and reactive model
  • Caching and batching

2.它的模块有哪些?功能分别是什么?

  • ribbon: APIs that integrate load balancing, fault tolerance, caching/batching on top of other ribbon modules and Hystrix
  • ribbon-loadbalancer: Load balancer APIs that can be used independently or with other modules
  • ribbon-eureka: APIs using Eureka client to provide dynamic server list for cloud
  • ribbon-transport: Transport clients that support HTTP, TCP and UDP protocols using RxNetty with load balancing capability
  • ribbon-httpclient: REST client built on top of Apache HttpClient integrated with load balancers (deprecated and being replaced by ribbon module)
  • ribbon-example: Examples
  • ribbon-core: Client configuration APIs and other shared APIs

3.哪些模块应用到生产了?

  • ribbon-core: deployed at scale in production
  • ribbon-eureka: deployed at scale in production
  • ribbon-evcache: not used
  • ribbon-guice: not used
  • ribbon-httpclient: we use everything not under com.netflix.http4.ssl. Instead, we use an internal solution developed by our cloud security team
  • ribbon-loadbalancer: deployed at scale in production
  • ribbon-test: this is just an internal integration test suite
  • ribbon-transport: not used
  • ribbon: not used

4.主要类及其层次结构

说明:

DynamicServerListLoadBalancer:A LoadBalancer that has the capabilities to obtain the candidate list of servers using a dynamic source. i.e. The list of servers can potentially be changed at Runtime. It also contains facilities wherein the list of servers can be passed through a Filter criteria to filter out servers that do not meet the desired criteria.

IClientConfig:Defines the client configuration used by various APIs to initialize clients or load balancers and for method execution. The default implementation is {@link DefaultClientConfigImpl}

IRule:Interface that defines a "Rule" for a LoadBalancer. A Rule can be thought of as a Strategy for loadbalacing. Well known loadbalancing strategies include Round Robin, Response Time based etc.

IPing:Interface that defines how we "ping" a server to check if its alive

ServerList:Interface that defines the methods sed to obtain the List of Servers

ServerListFilter:This interface allows for filtering the configured or dynamically obtained List of candidate servers with desirable characteristics.

ServerListUpdater:strategy for {@link com.netflix.loadbalancer.DynamicServerListLoadBalancer} to use for different ways of doing dynamic server list updates

与Eureka结合使用

当与Eureka组合使用Ribbon时,

server使用DiscoveryEnabledServer实现,Servers that were obtained via Discovery and hence contain meta data in the form of InstanceInfo。

ServerList接口会使用DiscoveryEnabledNIWSServerList实现,The server list class that fetches the server information from Eureka client. ServerList is used by {@link DynamicServerListLoadBalancer} to get server list dynamically.

ServerListFilter使用DefaultNIWSServerListFilter实现,The Default NIWS Filter - deals with filtering out servers based on the Zone affinity and other related properties。

ServerListUpdater使用EurekaNotificationServerListUpdater,A server list updater for the {@link com.netflix.loadbalancer.DynamicServerListLoadBalancer} that utilizes eureka's event listener to trigger LB cache updates。封装了LegacyEurekaClientProvider:A legacy class to provide eurekaclient via static singletons。

IPing使用NIWSDiscoveryPing实现,"Ping" Discovery Client,i.e. we dont do a real "ping". We just assume that the server is up if Discovery Client says so。

参考文章

【1】https://github.com/Netflix/ribbon

【2】http://blog.csdn.net/neosmith/article/details/53967330

转载于:https://www.cnblogs.com/davidwang456/p/6433200.html

netflix ribbon概述相关推荐

  1. java.lang.AbstractMethodError: org.springframework.cloud.netflix.ribbon.RibbonLoadBalancerClient.cho

    使用Ribbon负载均衡时出现有以下错误 java.lang.AbstractMethodError:org.springframework.cloud.netflix.ribbon.RibbonLo ...

  2. SpringCloud Netflix Ribbon

    文章目录 一. Ribbon简介 二. 使用Ribbon开发微服务 1 创建springcloud工程 和 commons子模块 2 开发服务提供者 - ribbonappservice 3 开发服务 ...

  3. 1、Ribbon概述

    1.1 什么是Ribbon 目前主流的负载方案分为以下两种: 集中式负载均衡,在消费者和服务提供方中间使用独立的代理方式进行负载,有硬件的(比如 交换机,F5),也有软件的(比如 Nginx). 客户 ...

  4. 深入浅出Spring Cloud Netflix - Ribbon

    文章目录 一.负载均衡 1.Load Balance是什么 2.负载均衡的分类 二.Ribbon详解 1.什么是Ribbon 2.Ribbon目前进入维护模式 3.Ribbon的工作流程 4.Ribb ...

  5. Spring Cloud 系列之 Netflix Ribbon 负载均衡

    什么是 Ribbon Ribbon 是一个基于 HTTP 和 TCP 的 客服端负载均衡工具,它是基于 Netflix Ribbon 实现的. 它不像 Spring Cloud 服务注册中心.配置中心 ...

  6. 什么是Netflix Ribbon?

    我们知道了微服务的基本概念,知道怎么基于Ribbon+restTemplate的方式实现服务调用,接着上篇博客,天猫转让我们再比较详细学习客户端负载均衡Netflix Ribbon,学习本博客之前请先 ...

  7. 带有Netflix Ribbon的Spring Cloud Rest Client-基础知识

    在较早的博客文章中,我介绍了Spring Cloud世界中REST客户端的各种选项. 所有选项围绕着基于Netflix OSS的名为Ribbon的组件,该组件处理与承载服务的不同实例之间的调用负载平衡 ...

  8. netflix feign概述

    1.什么是feign?feign的作用是什么? Feign is a java to http client binder inspired by Retrofit, JAXRS-2.0, and W ...

  9. SpringCloud Ribbon之概述(一)

    一:Ribbon是什么?  Ribbon是Netflix发布的开源项目,主要功能是提供客户端的软件负载均衡算法,将Netflix的中间层服务连接在一起.Ribbon客户端组件提供一系列完善的配置项如连 ...

最新文章

  1. 机房合作--那些数据类型
  2. boost::contract模块实现move的测试程序
  3. GARFIELD@10-07-2004
  4. 数字滤波器(一)--IIR与FIR的基本结构与MATLAB实现
  5. 学会这20条,做个聪明的人
  6. Jquery 实现动态添加输入框编号
  7. 类数据源Visual C++对ODBC数据库资源的访问
  8. Ubuntu[16.04/18.04/20.04] arm 下修改本地源 sources.list 为国内镜像
  9. Python搭建投票分类器模型来进行机器学习实验
  10. 判断浏览器内核是否是IE8及其以下
  11. 信息系统项目管理师——范围管理论文
  12. WIN2003 装不上mssql2000
  13. Domain Adaptation
  14. aptana php 调试,AptanaStudio3+PHP程序远程调试的方法和步骤
  15. 强改微信内置浏览器——让x5内核滚粗
  16. 16进制颜色识别和搭配规律 (实用)
  17. maven私有仓库的搭建——nexus的安装
  18. PHP 留言板功能需求分析
  19. SQL1084C Shared memory segments cannot be allocat
  20. 财路网每日原创推送:现在是时候让汽车高管们开始使用区块链了

热门文章

  1. sql删除语句_Part 3 | SQL学习:删除行
  2. 同大取大同小取小口诀图解_微信课堂:峦头九星砂体图解
  3. python bootstrap-fileinput示例_bootstrap fileinput完整实例分享
  4. uos系统断网怎么安装mysql_【学习笔记】 UOS安装MySQL
  5. Cortex-M3的工作模式和特权级别
  6. html5设计图的状态栏标准高度,HTML5 canvas自适应手机屏幕宽高度大小
  7. dbunit java_Java – 让DbUnit使用Hibernate事务
  8. mysql复制架构迁移到pxc_mysql复制(高可用架构方案的基础)
  9. python pip 安装与使用_Python pip 安装与使用(安装、更新、删除)
  10. emq插件开发mysql_EMQ的Mysql插件