1 / 13

Thrift 技术演进研讨

Thrift 技术演进研讨. 2011/10/09 李新阳. 演进的方向. 可用性: 消除单点故障隐患,提供水平扩容的基础 可管理 :提高服务监控的粒度、规范化程度、自动化程度 改进实现 : Client 端调用方式和 Server 端实现 方式. 方案介绍. Client Connection Lib com.netqin.thrift.lib.client. 可用性. Server Factory Lib com.netqin.thrift.lib.server. 水平扩展.

kairos
Download Presentation

Thrift 技术演进研讨

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Thrift技术演进研讨 2011/10/09 李新阳 NYSE: NQ

  2. 演进的方向 • 可用性:消除单点故障隐患,提供水平扩容的基础 • 可管理:提高服务监控的粒度、规范化程度、自动化程度 • 改进实现:Client端调用方式和Server端实现方式 NYSE: NQ

  3. 方案介绍 Client Connection Lib com.netqin.thrift.lib.client 可用性 Server Factory Lib com.netqin.thrift.lib.server 水平扩展 NQ Thrift Service Basecom.netqin.thrift.base 可管理性 Alabama(Config) Server com.netqin.thrift.alabama 改进和规范实现 Alabama Console(Web) Service Config and Monitor NYSE: NQ

  4. 一个视角:可用性和水平扩展 • 每个Thrift Service在不同硬件上启动多个Server • 在Alabama Console配置这些Service/Server的信息 • Client Connection Lib从Alabama Server获取这些Service/Server信息 • ClientConnectionLib检测多个Server的服务是否正常,并依据策略控制请求的分发 NYSE: NQ

  5. 一个视角:可管理性 • NQService中定义了管理界面(继承自fb303) • Alive/cpuXXX/version等等 • 所有Service都扩展NQService • Alabama Server统一管理所有Service/Server的配置信息 • Alabama Console从Alabama Server读取配置,调用每个Service的管理接口获取服务状态 NYSE: NQ

  6. 一个视角:改进和规范实现 通过Server Factory Lib和Client Connection Lib统一和规范了 • Transport的选择 • Protocol的选择 • Server的实现方式 • Client端连接池机制 • 简化Server构建、Client连接的代码 NYSE: NQ

  7. 另一视角:ClientConnectionLib • 使用方式 • CatService.Clientcat = (Client) ConnctionPool.get("CatService"); • cat.miao(); • ConnctionPool.close(cat); • 隐藏和标准化Protocol/Transport,隐藏和标准化初始化过程 • 配置管理 • 读本地配置 • 定期读Alabama Server的配置 • 集群 • 负载均衡、失败检测、重联机制 • 连接池 NYSE: NQ

  8. 另一视角:ServerFactoryLib • 使用方式 • Processor<Iface> processor = new CatService.Processor<Iface>(new Cat("huahua")); • TServer server = ServerFactory.create(processor, 2222).serve(); • 隐藏和标准化Protocol/Transport,隐藏和标准化初始化过程 • 为将来升级和优化Server实现打基础 • 比如从Thrift提供的Server,换为自己的Server实现 • 比如实现一个Server多个Service、实现公共日志 NYSE: NQ

  9. 另一视角:NQThriftServiceBase • 规约 • 所有NQ的thriftService在IDL里都extendsNQService • NQService extends fb303 • 使用样例(如何使用NQServiceBase来简化规约的实现) • Thrift文件:serviceCatService extends nq.NQService{ • Java文件:public class Cat extends NQServiceBase implements CatService.Iface • 用处 • Alabama Console里就可以查看每个Service的相关信息了 NYSE: NQ

  10. 另一视角:Alabama(Config) Server • 开在一个众所周知的IP和端口上,提供“DNS”服务 • Map<String, Service> getAllConfig() • Service getConfig(String service_name) • Alabama Server的调用者 • Client Connection Lib:定期更新Service配置 • Alabama Console:读取Service配置 NYSE: NQ

  11. 另一视角:AlabamaConsole(Web) • 功能 • 配置Service信息:写入数据源供Alabama Server读取 • 监控Service:从AlabamaServer读配置信息,逐一调用NQService中定义的方法获取Service状态 • 实现方式 • Python的Django做Web服务 • 读AlabamaServer中的配置信息 • 写入数据源(目前是sqllit数据库) NYSE: NQ

  12. That’s All • 请看演示 NYSE: NQ

  13. 我的问题 • 用什么Transport • 用什么Protocol • 用什么Server NYSE: NQ

More Related