Why Thrift, Why not HTTP RPC(JSON+gzip)

https://stackoverflow.com/questions/9732381/why-thrift-why-not-http-rpcjsongzip

89down voteaccepted

A few reasons other than speed:

  1. Thrift generates the client and server code completely, including the data structures you are passing, so you don't have to deal with anything other than writing the handlers and invoking the client. and everything, including parameters and returns are automatically validated and parsed. so you are getting sanity checks on your data for free.

  2. Thrift生成的代码,包含传递数据的数据结构。不用费劲地写客户端处理器,参数和返回值都被自动化实现验证,你可以很方便地对你的数据做常规的检查。
  3. Thrift is more compact than HTTP, and can easily be extended to support things like encryption, compression, non blocking IO, etc.

  4. Thrift比HTTP协议更紧凑,很容易扩展去支持一些东西:加密,压缩,非阻塞的IO。
  5. Thrift can be set up to use HTTP and JSON pretty easily if you want it (say if your client is somewhere on the internet and needs to pass firewalls)

  6. Thrift能够简单设置为使用HTTP协议和JSON协议,如果你需要这么做(比如说你的客户端运行在因特网的某个地方,需要穿越防火墙)。
  7. Thrift supports persistent connections and avoids the continuous TCP and HTTP handshakes that HTTP incurs.

  8. Thrift支持持久化连接,并且能够避免并不断的TCP和HTTP握手操作,这些操作常在HTTP协议里发生。

Personally, I use thrift for internal LAN RPC and HTTP when I need connections from outside.

I hope all this makes sense to you. You can read a presentation I gave about thrift here:

为什么要用Thrift的更多相关文章

  1. 和 Thrift 的一场美丽邂逅

    一. 与 Thrift 的初识 也许大多数人接触 Thrift 是从序列化开始的.每次搜索 “java序列化” + “方式”.“对比” 或 “性能” 等关键字时,搜索引擎总是会返回一大堆有关各种序列化 ...

  2. Apache thrift RPC 双向通信

    在上一篇介绍Apache thrift 安装和使用,写了一个简单的demo,讲解thrift服务的发布和客户端调用,但只是单向的客户端发送消息,服务端接收消息.而客户端却得不到服务器的响应. 在不涉及 ...

  3. common-pool2 学习:thrift连接池的另一种实现

    对象池是一种很实用的技术,经典的例子就是数据库连接池.去年曾经从零开始写过一个thrift客户端连接池.如果不想重造轮子,可以直接在apache开源项目commons-pool的基础上开发. 步骤: ...

  4. thrift:swift项目笔记

    先声明:此swift不是Apple公司的那个swift开发语言,而是facebook的另一个开源项目. facebook的thrift IDL文件,如果默认用thrift -gen java生成jav ...

  5. dubbo/dubbox 增加原生thrift及avro支持

    (facebook) thrift / (hadoop) avro / (google) probuf(grpc)是近几年来比较抢眼的高效序列化/rpc框架,dubbo框架虽然有thrift的支持,但 ...

  6. Thrift的TJsonProtocol协议分析

    Thrift协议实现目前有二进制协议(TBinaryProtocol),紧凑型二进制协议(TCompactProtocol)和Json协议(TJsonProtocol). 前面的两篇文字从编码和协议原 ...

  7. Thrift的TBinaryProtocol二进制协议分析

    先上张图,说明一下thrift的二进制协议是什么东东. 报文格式编码: bool类型: 一个字节的类型,两个字节的字段编号,一个字节的值(true:1,false:0). Byte类型: 一个字节的类 ...

  8. 高可用thrift客户池的实现详解

    最近,公司要求将组内的thrift客户端组件推广至公司内使用.基本的要求如下: 1.高可用 2.集成名称服务,也就配置文件支持服务发现 3.解耦,客户端和高可用组件解耦,简单来说就是,如果以后要切换其 ...

  9. 2016windows(10) wamp 最简单30分钟thrift入门使用讲解,实现php作为服务器和客户端的hello world

    2016最简单windows(10) wamp 30分钟thrift入门使用讲解,实现php作为服务器和客户端的hello world thrift是什么 最简单解释 thrift是用来帮助各个编程语 ...

  10. thrift 服务端linux C ++ 与客户端 windows python 环境配置(thrift 自带tutorial为例)

    关于Thrift文档化的确是做的不好.摸索了很久才终于把跨linux与windows跨C++与python语言的配置成功完成.以下是步骤: 1)                 Linux下环境配置 ...

随机推荐

  1. (15)Python时间

  2. Android逆向分析(2) APK的打包与安装

    http://blog.zhaiyifan.cn/2016/02/13/android-reverse-2/ 2/18日增加对aidl和java编译的描述. 前言 上一次我们反编译了手Q,并遇到了Ap ...

  3. 转://oracle 11gR2 oracle restart 单机使用asm存储 主机名发生更改处理过程

    oracle 11gR2 oracle restart 单机使用asm存储 主机名发生更改并且主机重启后处理过程: 以下为解决方案: 1. Remove Oracle Restart configur ...

  4. 2018 湖南网络比赛题 HDU - 6286 (容斥)

    题意:不说了. 更加偏向于数学不好的小可爱来理解的. 这篇博客更加偏重于容斥的讲解.用最直观的数学方法介绍这个题. 思路: 在a<=x<=b. c<=y<=d 中满足  x*y ...

  5. 多个Linux发行版安装ss服务端

    本文仅做技术探讨,请在遵守相应的法律法规的前提下使用. Centos 7一键安装脚本 简单快捷,随机生成密码,默认端口默认加密类型 bash <(curl -s http://morning.w ...

  6. Jmeter之mysql性能测试

    Jmeter官网地址:https://jmeter.apache.org/ 作为开发人员,必要的性能测试还是需要掌握的,虽然配置druid可以比较直观获得sql的执行时间,那些表被访问的比较多等等,但 ...

  7. PAT A1141 PAT Ranking of Institutions (25 分)——排序,结构体初始化

    After each PAT, the PAT Center will announce the ranking of institutions based on their students' pe ...

  8. 扫盲记-第六篇--Normalization

    深度学习模型中的Normalization 数据经过归一化和标准化后可以加快梯度下降的求解速度,这就是Batch Normalization等技术非常流行的原因,Batch Normalization ...

  9. ASP.NET 加密解密

    1.MD5 2.DES 一 MD5 介绍:MD5是不可逆解密方式,比如对密码的加密,为了保密,让密码不能解密 public static string MD5Encrypt(string str) { ...

  10. 【Codeforces 526D】Om Nom and Necklace

    Codeforces 526 D 题意:给一个字符串,求每个前缀是否能表示成\(A+B+A+B+\dots+A\)(\(k\)个\(A+B\))的形式. 思路1:求出所有前缀的哈希值,以便求每个子串的 ...