Protocol Buffers, Avro, Thrift,MessagePack区别

如何调试你的LLM应用程序:从入门到精通 了解如何调试LLM应用程序对于开发人员至关重要。通过Verbose和Debug模式,可以在不同深度追踪应用程序执行。LangSmith Tracing的可视化功能更是提升了调试体验。 阅读详情

 Perhaps one of the first inescapable observations that a newGoogle developer (Noogler) makes once they dive into the code is that ProtocolBuffers (PB) is the "language of data" at Google. Put simply,Protocol Buffers are used for serialization, RPC, and about everything inbetween.

 

Initially developed in early 2000's as an optimized serverrequest/response protocol (hence the name), they have become the de-facto datapersistence format and RPC protocol. Later, following a major (v2) rewrite in2008, Protocol Buffers was open sourced by Google and now, through a number ofthird party extensions, can be used across dozens of languages - includingRuby, of course.

 

But, Protocol Buffers for everything? Well, it appears towork for Google, but more importantly I think this is a great example of whereunderstanding the historical context in which each was developed is just asinstrumental as comparing features and benchmarking speed.

 

Protocol Buffers vs. Thrift

 

Let's take a step back and compare Protocol Buffers to the"competitors", of which there are plenty. Between PB, Thrift, Avroand MessagePack, which is the best? Truth of the matter is, they are all verygood and each has its own strong points. Hence, the answer is as much of apersonal choice, as well as understanding of the historical context for each,and correctly identifying your own, individual requirements.

 

When Protocol Buffers was first being developed (early 2000's),the preferred language at Google was C++ (nowadays, Java is on par). Hence itshould not be surprising that PB is strongly typed, has a separate schema file,and also requires a compilation step to output the language-specificboilerplate to read and serialize messages. To achieve this, Google definedtheir own language (IDL) for specifying the proto files, and limited PB'sdesign scope to efficient serialization of common types and attributes found inJava, C++ and Python. Hence, PB was designed to be layered over an (existing)RPC mechanism.

 

By comparison, Thrift which was open sourced by Facebook inlate 2007, looks and feels very similar to Protocol Buffers - in alllikelihood, there was some design influence from PB there. However, unlike PB,Thrift makes RPC a first class citizen: Thrift compiler provides a variety oftransport options (network, file, memory), and also tries to target many morelanguages.

 

Which is the "better" of the two? Both have beenproduction tested at scale, so it really depends on your own situation. If youare primarily interested in the binary serialization, or if you already have anRPC mechanism then Protocol Buffers is a great place to start. Conversely, ifyou don't yet have an RPC mechanism and are looking for one, then Thrift may bea good choice. (Word of warning: historically, Thrift has not been consistentin their feature support and performance across all the languages, so do someresearch).

 

Protocol Buffers vs. Avro, MessagePack

 

While Thrift and PB differ primarily in their scope, Avroand MessagePack should really be compared in light of the more recent trends:rising popularity of dynamic languages, and JSON over XML. As most every webdevelopers knows, JSON is now ubiquitous, and easy to parse, generate, andread, which explains its popularity. JSON also requires no schema, provides notype checking, and it is a UTF-8 based protocol - in other words, easy to workwith, but not very efficient when put on the wire.

 

MessagePack is effectively JSON, but with efficient binaryencoding. Like JSON, there is no type checking or schemas, which depending onyour application can be either be a pro or a con. But, if you are alreadystreaming JSON via an API or using it for storage, then MessagePack can be adrop-in replacement.

 

Avro, on the other hand, is somewhat of a hybrid. In itsscope and functionality it is close to PB and Thrift, but it was designed withdynamic languages in mind. Unlike PB and Thrift, the Avro schema is embeddeddirectly in the header of the messages, which eliminates the need for the extracompile stage. Additionally, the schema itself is just a JSON blob - no customparser required! By enforcing a schema Avro allows us to do data projections(read individual fields out of each record), perform type checking, and enforcethe overall message structure.

 

"The Best" Serialization Format

 

Reflecting on the use of Protocol Buffers at Google and allof the above competitors it is clear that there is no one definitive,"best" option. Rather, each solution makes perfect sense in thecontext it was developed and hence the same logic should be applied to your ownsituation.

 

If you are looking for a battle-tested, strongly typedserialization format, then Protocol Buffers is a great choice. If you also needa variety of built-in RPC mechanisms, then Thrift is worth investigating. Ifyou are already exchanging or working with JSON, then MessagePack is almost adrop-in optimization. And finally, if you like the strongly typed aspects, butwant the flexibility of easy interoperability with dynamic languages, then Avromay be your best bet at this point in time.

 

Ilya GrigorikIlya Grigorik is a web performance engineer anddeveloper advocate at Google, where his focus is on making the web fast anddriving adoption of performance best practices — follow on Twitter, Google+.

View comments (18), share on Twitter (239), Google+,Facebook (2).

High-Performance Browser Networking (O'Reilly)

What every web developer must know about networking andbrowser performance: impact of latency and bandwidth, TCP, UDP, and TLSoptimization, performance tips for mobile networks, and an under the hood lookat performance of HTTP 1.1/2.0, XMLHttpRequest, WebSocket, WebRTC, DataChannel,and other transports.

adb常用命令大全 ADB是Android Debug Bridge的缩写,它是一个命令行工具,主要用于在开发过程中实现计算机与Android设备之间的通信。ADB工具允许开发者执行一系列调试操作,如安装应用、管理应用的生命周期、读取日志数据、执行shell命令等。 阅读详情

相关推荐

Open UI5 源代码解析之232:ElementHooks.js

摘要 ElementHooks 是 OpenUI5 框架中的一个核心内部模块,位于 src/sap.ui.core/src/sap/ui/core/ElementHooks.js。该模块为 sap.ui.core.Element 的事件流提供低侵入的拦截机制,通过暴露一个可注入的 interceptEvent 函数属性(初始值为 null)实现。其主要设计目标是: 为框架支持层提供事件观测能力 避免直接修改核心事件分发代码 支持运行期动态启停拦截功能 该模块遵循严格的使用边界(@ui5-restricted

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 1040

MessagePack、Avro、Thrift、Protocol Buffers、JSON序列化协议

在Web开发中,难免遇到需要跨语言甚至跨平台进行通信的场景,不论是PHP到C还是PHP到Java,或者C到Java,都需要双方有一个约定的协议来打包和解包所传输的数据。双方自定义的协议固然效率高,但是通用性差,因此便出现了本文将要讨论的这些通用的、跨平台的数据打包协议。这些协议各有特点,应用场景也不尽相同,本文试图从某些我们经常会关注的角度来对这些序列化协议进行比较,以期能够为我们做技术选型提供指

记事本 7122

【信息科学与工程学】信息科学工程领域------第二十二篇 分布式设计09——设计模式(3)断路器模式

低空视联网作为低空经济的数字基座,通过融合通信、感知、智能计算等技术,实现对无人机等低空设备的全域管控与业务赋能。

weixin_49199313的博客 737

模型的参数verbose用法详解

模型的参数verbose含义 verbose是日志显示,有三个参数可选择,分别为0,1和2。 当verbose=0时,简单说就是不输入日志信息 ,进度条、loss、acc这些都不输出。 当verbose=1时,带进度条的输入日志信息,示例如下: 3. 当verbose=2时,为每个epoch输出一行记录,和1的区别就是没有进度条,示例如下: 训练和评估时都默认取值为1,但在评估时参数只有0和1。 ...

麻辣小龙虾的博客 6万+

Open UI5 源代码解析之1388:Editor.js

摘要 Editor.js是SAP OpenUI5项目中负责卡片配置编辑的核心控制器,位于sap.ui.integration.editor模块。作为复杂的企业级编辑器,它主要解决三大问题: 多层配置管理:处理来自manifest、designtime定义、manifestChanges覆盖等多源配置数据,支持差量合并和版本控制。 动态界面编排:根据字段类型自动选择控件(文本/数字/布尔等),处理数据请求、校验、提示等交互逻辑。 多角色协作:通过admin/content/translation等模式为不同用

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 973

【同花顺公式编辑教程】第3章 获取数据

学习同花顺公式编辑器,其提供的数据有量价数据以及财务数据。在本章中,我们讲解了编辑器执行代码的原理,并给出了可调用数据的汇总表。

LiaoYi2016218的博客 1万+

verbose的第一次接触

今天学习反射,第一次接触到了verbose参数, -verbose[:class|gc|jni] enable verbose output。 verbose [və:ˈbəus] a.冗长的 只加 -verbose这个参数,那么会显示所有加载的jar包的信息。 1,>java -verbose:class 可以查看JVM加载类的细节情况,如: [O...

weixin_34214500的博客 254

告别混乱!在Unity中为Best MQTT v3设计清晰的服务层:配置、连接、订阅发布模块拆分指南

本文详细介绍了如何在Unity中使用Best MQTT v3插件构建清晰的服务层架构,包括配置管理、连接服务、订阅管理和发布服务的模块化拆分。通过解耦设计、事件驱动和接口抽象,提升代码可维护性和可测试性,适用于物联网和实时通信开发场景。

weixin_30576827的博客 359

Protocol Buffers, Avro, Thrift & MessagePack

原文 一个新的谷歌开发人员 (Noogler) 在深入研究代码后首先不可避免的观察之一可能是协议缓冲区 (PB) 是谷歌的“数据语言”。 简而言之,Protocol Buffers 用于序列化、RPC 以及介于两者之间的所有内容。 最初在 2000 年代早期开发为优化的服务器请求/响应协议(因此得名),它们已成为事实上的数据持久性格式和 RPC 协议。 后来,在 2008 年进行了重大 (v2) 重写之后,Protocol Buffers 由 Google 开源,现在,通过许多第三方扩展,可以在数十种语言中

sunny_98_98的博客 467

这5组白月光少女三视图提示词直接用

今天分享5组治愈系白月光少女女主提示词,适合用于AI漫剧角色设计、角色库搭建和人物设定参考,所有提示词均是完整可复刻。

欢迎来到鸾姝淡月博客,专为程序员和编程爱好者打造的技术博客。我们分享编程语言趋势、开发工具、编程哲学、职业发展等,助你掌握新技术,优化技能,激发编程热情。 168

基于知识图谱的智能决策系统

作者:禅与计算机程序设计艺术 1.简介 知识图谱(Knowledge Graph)最早由美国斯坦福大学的Jure Sifne等人于2013年提出,它是一个用于存储、整理和推理复杂多变的网络结构信息的数据模型。它的基本特征是每个事实都有一个统一的标识符ID,并且可以以图形的方式展示各种关系及其边缘。因此,

AI天才研究院 2186

【java学习】序列化与反序列化:Json框架、xml转换、msgpack;java序列化

1,概念 1)JavaBean JavaBean不是一个编程规则,也不是语法规范,它是一个习惯性的编程规范。在fastJson中,解析用到的实体类必须严格按照JavaBean规范来写。 特点: ①类为public ②有一个无参数的构造方法。 ③属性为私有,通过getXxx()和setXxx方法设置属性(方法的第四个字母为大写)。 ④必须实现序列号接口。 2)JSONObje............

午后阳光 3801

组基轨迹建模 GBTM的介绍与实现(Stata 或 R)

组基轨迹建模(Group-Based Trajectory Modeling,GBTM)(旧名称:Semiparametric mixture model)历史:由DANIELS.NAGIN提出,发表文献《Analyzing Developmental Trajectories:A Semiparametric,Group-Based Approach》GBTM能够将一群人的轨迹分类并生成数个具有代表性的运动轨迹模型,然后对每个轨迹模型进行分析,以了解人们的运动特征、生理水平和风险等级等。

三分钟热度 1万+

从API调用者到系统构建者:掌握底层技术原理的实战指南

在软件开发领域,深入理解底层技术原理是提升工程能力的关键。从计算机科学基础概念出发,操作系统、网络协议和数据库等核心组件构成了现代应用系统的基石。其技术价值在于,开发者能超越框架API的简单使用,从被动应对问题转变为主动构建高效、稳定的系统。例如,理解JVM内存模型与垃圾回收机制,可以精准诊断内存泄漏;掌握I/O多路复用原理,能设计出支撑高并发的网络服务。在实际应用场景中,无论是优化秒杀系统的性能,还是解决分布式环境下的数据一致性问题,都需要综合运用这些底层知识进行权衡与设计。本文聚焦于JVM、TCP/IP

weixin_33957648的博客 363

PCL 4PCS算法实现点云粗配准【2026最新版】

博客长期更新,本文最新更新时间为:2026年5月11日。

点云侠的博客 30万+

详解FreeRTOS:FreeRTOSConfig.h系统配置文件(拓展篇—1)

FreeRTOS的系统配置文件为FreeRTOSConfig.h,在配置文件中可以完成FreeRTOS的裁剪和配置,这是非常重要的一个文件,本篇博文就来讲解这个文件。

不脱发的程序猿 1551

Android中如何手动制造logcat各等级日志(VERBOSE、DEBUG、INFO、WARNING、ERROR、FATAL)

如何在Android中手动生成logcat日志,有下面这个方法。。

mini小新的博客 3663

华为OD干了两个月,还是跑了

​本人工作了快13年,base南京。2024年2月份由于公司业务变动第一次拿到了公司发的大礼包,同时也面临着失业的问题,我对自己的技术还是很有信心的,但是,找了大概有一个多月时间,发现心意的工作的确不太好找,当然收到挺多家offer,就是薪资不太满意,外包也一直不想去,不过说实话外包给的薪资普遍要比自研的单位要高一些,最后为了钱还是进华为(既然选择外包那就选择好一些的吧),毕竟中年老男人工作不能断太久。

啊渊的专栏 1万+

【tensorflow学习笔记】tf中常用参数含义

对tensorflow学习中遇到的一些常用参数进行一些记录;

weixin_43983674的博客 686

STM32F407中文手册

STM32f407中文手册 本参考手册面向应用开发人员,提供有关使用 STM32F405xx/07xx、STM32F415xx/17xx、 STM32F42xxx 和 STM32F43xxx 微控制器存储器与外设的完整信息。STM32F405xx/07xx、STM32F415xx/17xx、STM32F42xxx 和 STM32F43xxx 构成一个微 控制器系列,各产品具有不同的存储器大小、封装和外设。有关订购信息以及器件的机械与电气特性,请参见数据手册。有关 ARM Cortex™-M4F 内核的信息,请参见《Cortex™-M4F 技术参考手册》。

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

verbose = True

verbose = True

qq_51241339的博客 1717

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

虚拟机查看命令verbose

java -verbose[:class|gc|jni] 在输出设备上显示虚拟机运行信息。 1.java -verbose:class 在程序运行的时候究竟会有多少类被加载呢,一个简单程序会加载上百个类的!你可以用verbose:class来监视,在命令行输入java -verbose:class XXX  (XXX为程序名)你会在控制台看到加载的类的情况。  verbose和verbose...

思考与学习 1525

efm32 入门.pdf

本PDF共计22页,介绍的是操作驱动API,下载与否自己斟酌。

JVM -verbose参数详解

箭头前后的数据256K和160K分别表示垃圾收集GC前后所有存活对象使用的内存容量,说明有256K-160K=96K的对象容量被回收,括号内的数据124096K为堆内存的总容量,收集所需要的时间是0.0042708秒(这个时间在每次执行的时候会有所不同)。在虚拟机发生内存回收时在输出设备显示信息,格式如下: [Full GC 256K->160K(124096K), 0.0042708 secs] 该参数用来监视虚拟机内存回收的情况。* JVM -verbose[:class|gc|jni] 参数测试。

QQ1057081261的专栏 1648

Apache Avro 与 Thrift 比较

Avro和Thrift都是跨语言,基于二进制的高性能的通讯中间件. 它们都提供了数据序列化的功能和RPC服务. 总体功能上类似,但是哲学不一样. Thrift出自Facebook用于后台各个服务间的通讯,Thrift的设计强调统一的编程接口的多语言通讯框架. Avro出自Hado

冯立彬的博客 1万+

MessagePack简析

一、MessagePack是什么 先看官方的定义:MessagePack是一种高效的二进制序列化格式。它允许您像JSON一样在多个语言之间交换数据。但是,它更快并且更小。 从官方定义中,可以有如下的结论: MessagePack是一个二进制序列化格式,因而它序列化的结果可以在多个语言间进行数据的交换。 从性能上讲,它要比json的序列化格式要好。 ...

dly41721的博客 1034

thrift与avro RPC使用对比与总结

thrift与avro在rpc方面的使用与代码示例入门总结

shb19891的专栏 5796

python美化输出模块_python logging模块的使用总结

日志级别CRITICAL 50ERROR 40WARNING 30INFO 20DEBUG 10logging.basicConfig()函数中的具体参数含义filename:指定的文件名创建FiledHandler,这样日志会被存储在指定的文件中;filemode:文件打开方式,在指定了filename时使用这个参数,默认值为“w”还可指定为“a”;format:指定handler使用的日志显示...

weixin_39924481的博客 486
上一篇: 基于Yarn运行spark应用的进程分析
下一篇: hadoop1.x 与hadoop2.x 架构变化分析
reylee911
博客等级 码龄12年 6粉丝 11原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值