Are binary protocols dead?

Earlz picture Earlz · Mar 26, 2010 · Viewed 10.7k times · Source

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?

Answer

Eric J. picture Eric J. · Mar 26, 2010

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.