二进制协议死了吗? [英] Are binary protocols dead?

查看:26
本文介绍了二进制协议死了吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

由于当时的互联网速度非常慢(拨号),似乎过去有更多的二进制协议.我一直看到一切都被 HTTP 和 SOAP/REST/XML 取代.

It seems like there used to be way more binary protocols because of the very slow internet speeds of the time (dialup). I've been seeing everything being replaced by HTTP and SOAP/REST/XML.

这是为什么?

二进制协议真的死了还是只是不那么流行了?为什么他们会死或不那么受欢迎?

Are binary protocols really dead or are they just less popular? Why would they be dead or less popular?

推荐答案

你无法打败二进制

二进制协议总是比文本协议更节省空间.即使互联网速度急剧增加,我们希望传达的信息的数量和复杂性也在增加.

Binary protocols will always be more space efficient than text protocols. Even as internet speeds drastically increase, so does the amount and complexity of information we wish to convey.

您引用的文本协议在标准化、灵活性和易用性方面非常出色.然而,总会有一些应用程序的二进制传输效率会超过这些因素.

The text protocols you reference are outstanding in terms of standardization, flexibility and ease of use. However, there will always be applications where the efficiency of binary transport will outweigh those factors.

大量信息本质上是二进制的,可能永远不会被文本协议取代.视频流就是一个明显的例子.

A great deal of information is binary in nature and will probably never be replaced by a text protocol. Video streaming comes to mind as a clear example.

即使您压缩基于文本的协议(例如使用 GZip),通用压缩算法也永远不会像围绕特定数据流设计的二进制协议那样有效.

Even if you compress a text-based protocol (e.g. with GZip), a general purpose compression algorithm will never be as efficient as a binary protocol designed around the specific data stream.

但有时您不必

您看到更多基于文本的协议的原因是,与广泛应用的数据大小相比,传输速度和数据存储容量确实增长得很快.我们人类发现使用文本协议更容易,因此我们围绕文本表示设计了我们无处不在的 XML 协议.当然,如果我们真的必须保存每个字节,并构建通用工具来可视化和处理数据,我们可以将 XML 创建为二进制协议.

The reason you are seeing more text-based protocols is because transmission speeds and data storage capacity have indeed grown fast compared to the data size for a wide range of applications. We humans find it much easier to work with text protocols, so we designed our ubiquitous XML protocol around a text representation. Certainly we could have created XML as a binary protocol, if we really had to save every byte, and built common tools to visualize and work with the data.

再说一次,有时候你真的会这样做

许多开发人员习惯于考虑多 GB、多核计算机.即使是你现在的典型手机也让我的第一台 IBM PC-XT 感到羞耻.尽管如此,仍有一些平台(例如嵌入式设备)对处理能力和内存有相当严格的限制.在处理此类设备时,二进制文件可能是必需的.

Many developers are used to thinking in terms of multi-GB, multi-core computers. Even your typical phone these days puts my first IBM PC-XT to shame. Still, there are platforms such as embedded devices, that have rather strict limitations on processing power and memory. When dealing with such devices, binary may be a necessity.

这篇关于二进制协议死了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆