I am wondering what the differences are between binary and text based protocols. I read that binary protocols are more compacts/faster to process. How does that work out? Since you have to send the same amount of data? No?
E.g how would the string "hello" differ in size in binary format?
A binary protocol utilizes all values of a byte, as opposed to a text-based protocol which only uses values corresponding to human-readable characters in ASCII encoding. Binary protocols are intended to be read by a machine rather than a human being.
Text protocols are better in terms of readability, ease of reimplementing, and ease of debugging. Binary protocols are more compact. However, you can compress your text using a library like LZO or Zlib, and this is almost as compact as binary (with very little performance hit for compression/decompression.)
The HTTP protocol itself is readable as text. This is useful because you can telnet into any server at all and communicate with it. Being text also allows you to easily watch HTTP communication with a program like wireshark.
Text protocol commands are sent from client to server. The text protocol has a less comprehensive format than the binary protocol, which is used by prepared statements only.
If all you are doing is transmitting text, then yes, the difference between the two isn't very significant. But consider trying to transmit things like:
Text protocols are better in terms of readability, ease of reimplementing, and ease of debugging. Binary protocols are more compact.
However, you can compress your text using a library like LZO or Zlib, and this is almost as compact as binary (with very little performance hit for compression/decompression.)
You can read more info on the subject here:
http://www.faqs.org/docs/artu/ch05s01.html
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With