问题描述
好像有曾经是因为时间(拨号)非常慢的上网速度的方式更二进制协议。我已经看到的一切是由HTTP和SOAP / REST / XML所取代。
这是为什么?
是二进制协议真的死了或者他们只是不太受欢迎?他们为什么会死还是冷门?
你就不能击败二进制
二进制协议将永远是更多的空间比文字协议有效。即使上网速度大幅增加,也是如此,我们希望传达的信息量和复杂性。
您引用的文本协议的标准化,灵活性和易用性方面都很优秀。然而,总是会有应用场合二进制传输的效率将超过这些因素。
中的大量信息在本质上是二进制和可能永远不会由文本的协议所取代。视频流媒体想到一个明显的例子。
即使玉米preSS一个基于文本的协议(例如,用gzip),一般用途的COM pression算法永远不会为二进制协议的特定数据流周围设计为高效。对>
,但有时你不必
您看到越来越多的基于文本的协议,是因为传输速度和数据存储容量确实增长迅速相比,广泛的应用程序的数据大小。我们人类发现它更容易与文字协议工作,所以我们在设计无处不在XML协议重新周围presentation文本。当然,我们可以创建XML作为一种二进制协议,如果我们真的有救每一个字节,并内置常用工具进行可视化和处理数据。
话又说回来,有时候你真的
许多开发人员都使用多GB,多核计算机的思维。即使你的典型的电话这几天把我的第一个IBM PC-XT羞愧。尽管如此,仍有平台如嵌入式设备中,具有对处理能力和存储器,而严格的限制。当这样的设备处理,二进制可能是必要的。
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.
Why is this?
Are binary protocols really dead or are they just less popular? Why would they be dead or less popular?
You Just Can't Beat the Binary
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.
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.
But Sometimes You Don't Have To
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.
Then Again, Sometimes You Really Do
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.
这篇关于是二进制协议死了吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!