Thanks Tom for the comments.
But we must take care not to mix the layers in such cases!
Transmission Protocol
About transmission protocol, HTTP is a layer over TCP, and has not such a
big overhead.
By design, http.sys won’t enable use of TCP/IP protocol (unless you
use Windows 8 and
switch to websockets mode, but it is not very well supported over all
networks).
A TCP layer won’t be faster in practice.
But mORMot proposes other transmission protocols, such as
in-process calls, or named pipe or GDI messages (the later is very efficient in
practice, but only works locally).
You can have several protocols at once, in just one code line each, to publish
an unique server. Or you can host several servers on the same process/service.
For instance, you can do load-balancing in a logical n-Tier architecture, using
GDI messages locally between
application and domain layer, but a public HTTP front end.
Application Layer
About application data content format, we use JSON and a REST/stateless routing scheme.
We found out JSON to be very efficient, better than XML, and comparable to
binary protocols in most cases. We can optionally use deflate/zip compression
or our own very optimized SynLZ algorithm, to reduce bandwidth.
In practice JSON is much more easy to work with from any client (including
JavaScript/AJAX or even a human brain) than any binary layout. Packet
inspection software will like JSON much more than a binary content.
For instance, mORMot is able to use a “stretched” layout when returning a list of data, sending them as an array of items with the headers just sent once, instead of an array of objects. We have to embed small BLOBs as Base64, but the framework handles and prefers a direct RESTful remote access via a dedicated URI and direct binary download via a regular GET.
We use a very fast in-place
JSON parsing (like a SAX approach) instead of a DOM-like template.
And when it deals with database access, we directly convert the DB client
buffers into JSON content, with no temporary storage.
Performance is outstanding, especially insertion in BATCH mode and reading
results can be even better when internal ORM cache is enabled (it was disabled
for this testing, on purpose). Those benchmarks let shine mORMot's JSON
marshalling of the data, to and from object instances and the database
optimized drivers.
Nice and easy mORMot
From our tests on real world data, due to the TCP packet overhead, using JSON over HTTP is just a very good option, just in-between XML/SOAP and proprietary binary content, without any compatibility concern.