• Thrift vs. Protocol Buffers


    http://incubator.apache.org/thrift/

    http://code.google.com/p/thrift-protobuf-compare/wiki/Benchmarking

    http://code.google.com/intl/zh-CN/apis/protocolbuffers/docs/overview.html

    简介

    Thrift Facebook 的核心框架之一,使不同的开发语言开发的系统可以通过该框架实现彼此的通信,类似于 webservice ,但是 Thrift 提供了近乎变态的效率和开发的方便性,是 webservice 所不能比拟的。给分布式开发带来了极大的方便。但是这柄利器也有一些不完美。

     

    问题

    首先文档相当的少,只有一个 wiki 网站提供相应的帮助。这对于 Thrift 的推广极为不利。

    其次框架本身实现有一些缺陷,就 Thrift java 部分来说,没有提供连接池的支持,对 RPC 的调用效率有所影响。

    对于文档稀少的问题,只能是通过一些 Thrift 的开发者和使用者多供献一些自己的心得来解决。这得需要一个过程。而连接池的问题的解决则可以快速一些。

             提到池一般做过 Java 开发的肯定会想到 ObjectPool Apache Commons 项目确实给我们的开发得来了很大的便利性,其中的 pool 项目正是我们实现 thrift 连接池的基础,当然也少不了神器 spring framework

    hrift

      thrift是一种可伸缩的跨语言服务的发展软件框架。它结合了功能强大的软件堆栈的代码生成引擎,以建设服务,工作效率和无缝地与C + +,C#,Java,Python和PHP和Ruby结合。thrift是facebook开发的,我们现在把它作为开源软件使用。thrift允许你定 义一个简单的定义文件中的数据类型和服务接口。以作为输入文件,编译器生成代码用来方便地生成RPC客户端和服务器通信的无缝跨编程语言。

    Protocol Buffers

      Protocol BuffersGoogle 公司开发的一种数据描述语言,类似于XML 能够将结构化数据序列化,可用于数据存储、通信协议等方面。现阶段支持C++、JAVA、Python等三种编程语言。   为什么不只用XML? 同XML相比,Protocol buffers在序列化结构化数据方面有许多优点(google官方提出):   ·更简单   ·数据描述文件只需原来的1/10至1/3   ·解析速度是原来的20倍至100倍   ·减少了二义性   ·生成了更容易在编程中使用的数据访问类   google大概是今天(08年7月8号)将其作为开源项目对外公布,说是后续还要开源的项目有不少都会用到Protocol Buffers。 #bk-album-collection-box-1708160 { 687px; height: 228px; border-right: 1px solid rgb(198, 225, 245); border- 2px 1px 1px; border-style: solid; border-color: rgb(38, 139, 215) rgb(198, 225, 245) rgb(198, 225, 245); margin-bottom: 30px; overflow: hidden; }.bacb-head { height: 28px; background-color: rgb(245, 251, 255); padding-left: 10px; position: relative; }.bacb-title { font-size: 14px; font-weight: bold; line-height: 28px; }.bacb-more { text-decoration: none; position: absolute; font-size: 12px; line-height: 1; top: 8px; right: 8px; padding-right: 11px; background: url("http://img.baidu.com/img/baike/s/arr.gif") no-repeat scroll 54px -22px transparent; }.bacb-more:hover { text-decoration: none; }#bacb-left-btn-1708160, .bacb-window-outer, #bacb-right-btn-1708160 { float: left; }#bacb-left-btn-1708160, #bacb-right-btn-1708160 { display: block; text-decoration: none; border: 1px solid rgb(255, 255, 255); 17px; height: 53px; background: url("http://img.baidu.com/img/baike/bkalbumbtn.gif") no-repeat scroll 0% 0% transparent; cursor: default; }#bacb-left-btn-1708160 { margin: 59px 3px 0pt 6px; background-position: 3px 16px; }#bacb-right-btn-1708160 { margin: 59px 5px 0pt 6px; background-position: -27px 16px; }#bacb-left-btn-1708160.enable:hover { background-position: -61px 16px; border: 1px solid rgb(221, 221, 221); cursor: pointer; }#bacb-right-btn-1708160.enable:hover { background-position: -91px 16px; border: 1px solid rgb(221, 221, 221); cursor: pointer; }.bacb-window-outer { 628px; height: 185px; position: relative; overflow: hidden; margin-top: 15px; }#bacb-window-inner-1708160 { position: absolute; top: 0pt; left: 0pt; padding-left: 6px; }#bacb-window-inner-1708160 .item { float: left; 156px; height: 195px; }#bacb-window-inner-1708160 .img { height: 145px; position: relative; }#bacb-window-inner-1708160 .img .b1, #bacb-window-inner-1708160 .img .b2, #bacb-window-inner-1708160 .img .b3, #bacb-window-inner-1708160 .img .img-wrapper { position: absolute; background-color: rgb(255, 255, 255); }#bacb-window-inner-1708160 .img .b1 { left: 0pt; bottom: 0pt; border: 1px solid rgb(205, 205, 205); }#bacb-window-inner-1708160 .img .b2 { left: 3px; bottom: 3px; border: 1px solid rgb(205, 205, 205); }#bacb-window-inner-1708160 .img .b3 { left: 6px; bottom: 6px; border: 1px solid rgb(170, 170, 170); }#bacb-window-inner-1708160 .img .img-wrapper { left: 9px; bottom: 9px; display: block; text-decoration: none; line-height: 1px; }#bacb-window-inner-1708160 .item .desc { text-align: center; font-family: 宋体; 145px; margin-top: 7px; font-size: 12px; line-height: 1; }#bacb-window-inner-1708160 .item .count { color: rgb(153, 153, 153); white-space: nowrap; }
    扩展阅读:
  • 相关阅读:
    mongodb 聚类查询 筛选时间
    异步线程
    性能优化
    何谓引继(引继码,继承码)?了解引继同备份不同,请注意!
    apktool 无法识别 requestLegacyExternalStorage 属性导致回编失败
    Jenkins GIT_SSH组件权限导致build失败的问题。
    Linux下 Nginx-uWSGI-Django 搭建
    SSH scp使用
    Django创建app及创建数据库
    正则表达式
  • 原文地址:https://www.cnblogs.com/kex1n/p/2286436.html
Copyright © 2020-2023  润新知