1 / 7

Thrift 与 Gearman 简介

Thrift 与 Gearman 简介. By 薛长俊 2010-01-29. Thrift 背景介绍. 开源多语言 RPC 框架。. 完整的 RPC 框架实现,用脚本生成通讯相关的框架代码,开发者只需要集中精力处理好业务逻辑。比如搭建一个 Hello World Service 只需要几分钟。 支持非常多的语言,包括 PHP ,以及最常用的 WEB 后端开发语言 C++/Python/Java 等 ,当然,还包括 Ruby , Erlang , Perl , Smalltalk 等其他的语言。

sheng
Download Presentation

Thrift 与 Gearman 简介

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 与 Gearman简介 By 薛长俊2010-01-29

  2. Thrift背景介绍 开源多语言 RPC 框架。 • 完整的 RPC 框架实现,用脚本生成通讯相关的框架代码,开发者只需要集中精力处理好业务逻辑。比如搭建一个 Hello World Service 只需要几分钟。 • 支持非常多的语言,包括PHP,以及最常用的WEB后端开发语言C++/Python/Java 等 ,当然,还包括Ruby,Erlang,Perl,Smalltalk等其他的语言。 • 拥有被 Facebook、Last.fm 等不少大规模互联网应用验证过的性能和可用性。 返回

  3. Gearman背景介绍 分布式处理及任务调度框架。 • 提供一个服务器端和多种语言的客户端接口,包括 C/PHP/Perl/Python/Java/Ruby 等 。 • Gearnan的体系机构中一般包括三个部分: 一个Client,一个Worker,一个Job Server。 Client负责创建并发起一个job请求;Job Server负责找到合适的Worker,Worker负责执行job。 • 可以将执行同一job的多个Worker部署在多个服务器上, Job Server 会提供负载均衡的功能。还可以运行多个Job Server,如果一个Job Server down了,Client和Worker会自动迁移到另一台Job Server上。 返回

  4. Thrift实现原理 统一格式配置文件。 • 支持的数据类型: • bool:布尔型。 • byte:字节型。 • i16: 16位整型。 • i32: 32位整型。 • i64: 64位整型。 • double: 浮点型。 • string: 字符串。 • 支持的方法格式: • service <name> { • <returntype> <name>(<arguments>) • [throws (<exceptions>)] • ... • } 返回

  5. Thrift实现原理 配置文件举例(cache.thrift)。 struct CacheProfile{ 1:stringkey, 2:stringvalue } service CacheStorage{ i32 cache_set(1:string key, 2:string value), string cache_get(1:string key) } 脚本生成框架代码模板。 thrift --gen cpp cache.thrift thrift --gen py cache.thrift 业务逻辑开发。 返回

  6. Gearman实现原理 原理。 工作流。 返回

  7. Gearman分布式管理 分为四部分。 • 客户端Client(PHP + Gearman客户端扩展)。 • 调度器(Gearman Job Server):如果其中一台宕机服务不受影响。 • 处理结点进程Worker(使用高性能的C/C++/Java语言开发):按照访问量的大小使用多台服务器进行分布式处理。 • 控制器(控制Worker结点进程,更新Worker结点代码)。

More Related