Linked by Thom Holwerda on Wed 25th Jan 2012 22:05 UTC, submitted by twitterfire
Internet & Networking "Google's efforts to improve Internet efficiency through the development of the SPDY (pronounced 'speedy') protocol got a major boost today when the chairman of the HTTP Working Group (HTTPbis), Mark Nottingham, called for it to be included in the HTTP 2.0 standard. SPDY is a protocol that's already used to a certain degree online; formal incorporation into the next-generation standard would improve its chances of being generally adopted."
Thread beginning with comment 504772
To view parent comment, click here.
To read all comments associated with this story, please click here.
RE[3]: no binary protocols please
by Alfman on Thu 26th Jan 2012 19:40 UTC in reply to "RE[2]: no binary protocols please"
Alfman
Member since:
2011-01-28

Neolander,

"Text also has advantages beyond human readability though, like the availability of many quality parsers"

My opinion is that binary protocols don't need to be difficult to implement, sometimes they're even easier to implement than the text parsers. It could go either way: SMTP is very difficult due to the complexity of ASN encoding, which is designed to serialize arbitrary hierarchical objects, others like Modbus borderline on trivial.

One of the problems with pure text is that we have to scan strings of unknown length which is far less efficient than knowing string lengths up front. It's the difference between pascal strings and c-strings. With terminated strings, every single byte has to be checked. When the length is specified, data can be copied/compared at least 8 bytes at a time on many architectures.

Also, text based protocols like HTTP have to accept superfluous whitespace and 3 different types of newline encodings, all of which makes parsing even less efficient.

All this says nothing of unicode support, which if required makes the delimiter scans even more difficult due to erroneous byte matches within multi-byte unicode sequences.


"and the fact that text-based protocols abstract away endianness issues in the underlying text transmission protocol."

Yes, endianness is a problem, however let me point out that it would be equally problematic for text-represented numbers if humans had not standardized on big-endian numeric representation for themselves. There's nothing stopping binary protocols from standardizing a byte order (network byte order) in the same way.

Reading/writing textual numbers requires multiplying/dividing decimal digits one at a time. When using binary numbers, they can be processed in their entirety with a possible opcode for byte swap. Also, since every binary byte represents a valid number, no ASCII digit tests are required.


All in all, binary protocols are more efficient, but the question goes back to how large is text overhead compared to the payload itself? Probably not much. Only once HTTP is used for highly asynchronous/multiplexed communication will it's overhead start to overtake the payload.


I think there is (legitimate) fear that binary protocols would be extended in proprietary & undocumented ways to make it incompatible, and that would be a damn shame. This is why it'd be crucial for the standard to mandate clients/servers break the connection on non-standard requests, it would force developers to get their act together with regards to total standard compliance.

Reply Parent Score: 2

Lennie Member since:
2007-09-22

Did you really mean SMTP when you talked about ASN.1 ?

Because I think you are mistaken, I've never seen it in SMTP. SMTP is an example of a text protocol.

All I could find about ASN.1 is a bug in the GSSAPI (authentication) of Microsoft Exchange.

Maybe you meant SNMP ?

Reply Parent Score: 2

Alfman Member since:
2011-01-28

Lennie,

"Did you really mean SMTP when you talked about ASN.1 ?"
"Maybe you meant SNMP ?"

Sometimes I'm baffled at how I write the wrong thing sometimes. Yes I wrote an SNMP client for a legacy DOS system using pascal. And I found ASN difficult to use from such a statically structured language.

I haven't read anything indicating HTTP would become binary, but if it were to be I think a simple binary name/value container would do fairly well without much trouble.

Reply Parent Score: 2