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

netflix ribbon概述的更多相关文章

  1. SpringCloud Netflix Ribbon(负载均衡)

    ⒈Ribbon是什么? Spring Cloud Ribbon是基于Netflix Ribbon实现的一套客户端负载均衡工具. Ribbon是Netflix发布的开源项目,主要功能是提供客户端的软件负 ...

  2. Netflix Ribbon源码设计错误的证据(附正确示例)

    我在之前一篇博客里https://www.cnblogs.com/yangfeiORfeiyang/p/9644254.html 里对Netflix Ribbon的Loadbalancer类源码设计的 ...

  3. SpringCloud学习笔记(四、SpringCloud Netflix Ribbon)

    目录: Ribbon简介 Ribbon的应用 RestTemplate简介 Ribbon负载均衡源码分析 Ribbon简介: 1.负载均衡是什么 负载均衡,根据其字面意思来说就是让集群服务具有共同完成 ...

  4. SpringCloud系列之客户端负载均衡Netflix Ribbon

    1. 什么是负载均衡? 负载均衡是一种基础的网络服务,它的核心原理是按照指定的负载均衡算法,将请求分配到后端服务集群上,从而为系统提供并行处理和高可用的能力.提到负载均衡,你可能想到nginx.对于负 ...

  5. Spring Cloud Netflix Ribbon详细介绍及自定义规则策略

    之前文章我们介绍了如何配置具有Ribbon轮询机制的负载均衡策略的消费者,这次来具体了解一下Ribbon的一些细节,以及如何自定义负载均衡策略等. 说一下Ribbon实现负载均衡的大致思路.它通过用@ ...

  6. SpringCloud Netflix Ribbon

    Eureka客户端的负载均衡:从Eureka server拿到节点列表,客户端自己使用负载均衡的算法确定要使用的节点: Eureka服务端的负载均衡:服务端使用负载均衡的算法,从节点列表中确定要使用的 ...

  7. 对Netflix Ribbon的Loadbalancer类源码设计合理性的一点质疑

    首先,这只是我个人的一点质疑,可能是因为我自己菜没有领悟到作者的意思,也正因此,想发出来跟大家一起探讨. 在昨晚,我因为在编写自己的开源项目的负载均衡模块(这是我开源项目的介绍:https://www ...

  8. netflix turbine概述

    1.turbine是什么?它的作用是什么? Turbine is a tool for aggregating streams of Server-Sent Event (SSE) JSON data ...

  9. netflix feign概述

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

随机推荐

  1. Dom编程(二)

    document是window对象的一个属性,因为使用window对象成员的时候可以省略window.,所以一般直接写document  document的方法: (1)write:向文档中写入内容. ...

  2. BZOJ2064: 分裂

    2064: 分裂 Time Limit: 10 Sec  Memory Limit: 64 MBSubmit: 360  Solved: 220[Submit][Status][Discuss] De ...

  3. SQL数据库修复/数据库置疑修复

    SQL数据库修复的三大核心技术: 1.磁盘阵列分析重组技术: 2.数据库恢复与修复技术: 3.SCSI盘物理故障开盘技术. 至今已经成功恢复数百台服务器的SQL数据库,用户覆盖全国. 导致SQL数据库 ...

  4. Linux之目录基本操作命令

    Linux之目录基本操作命令 目录基本操作命令 1.tree命令 tree命令以树状图列出目录的内容. 语法 tree(选项)(参数) 选项 1.-a显示所有文件和目录 2.-A使用ASNI绘图字符显 ...

  5. OSG世界坐标转屏幕坐标(转载)

    OSG世界坐标转屏幕坐标 #define M(row,col) m[col * 4 + row] void Transform_Point(double out[4], const double m[ ...

  6. 八 Appium常用方法介绍

    由于appium是扩展了Webdriver协议,所以可以使用webdriver提供的方法,比如在处理webview页面,完全可以使用webdriver中的方法.当然在原生应用中,也可以使用. 1.元素 ...

  7. spark使用总结

    背景 使用spark开发已有几个月.相比于python/hive,scala/spark学习门槛较高.尤其记得刚开时,举步维艰,进展十分缓慢.不过谢天谢地,这段苦涩(bi)的日子过去了.忆苦思甜,为了 ...

  8. Bootstrap每天必学之导航条

    http://www.jb51.net/article/75534.htm Bootstrap每天必学之导航条,本文向大家讲解了多种多样的导航条,以及导航条中元素的实现方法,感兴趣的小伙伴们可以参考一 ...

  9. HBuilder开发App教程04-最难搞定的是mui

    前言 前几篇说到一些HBuilder开发app的基础教程, 现在来说一下HBuilder开发app的难点,或者说是上手的难点, 就是mui, 如果你没有研究mui就贸然的上手HBuilder,那你的开 ...

  10. HUD-5124-lines

    题目链接 http://acm.hdu.edu.cn/showproblem.php?pid=5124 这题题目做的好悲催,比赛时题目意思不理解,也没有深究了,赛后又看了很久没有看懂,问了很多才搞懂, ...