Its common to define a system's behaviour by its protocol. Actually, a protocol messes up two distinct aspects of communication, namely:
- Encoding of messages
- Semantics and behavior (request/response, signals, state transition of communication parties ..)
Frequently (not always), these two very distinct aspects are mixed up without need. So we are forced to run the whole internet in "debug mode", as 99% of webservice and webapp communication is done using textual protocols.
The overhead in CPU consumption compared to a well defined binary encoding is factor ~3-5 (JSON) up to >10-20 (XML). The unnecessary waste of bandwith also adds to that greatly (yes you can zip, but this in turn will waste even more CPU).
I haven't calculated the numbers, but this is environmental pollution at big scale. Unnecessary CPU consumption to this extent wastes a lot of energy (global warming anyone ?).
Solution is easy:
- Standardize on some simple encodings (pure binary, self describing binary ("binary json"), textual)
- Define the behavioral part of a protocol (exclude encoding)
- use textual encoding during development, use binary in production.