How TCPIP Works, Part 3: Framing Data
As someone that just uses WCF to get a job done, you may be wondering why it's important to know about all of those network protocols that I talked about yesterday. Well, in exchange for helping move your data around, every protocol layer you go through in the network stack charges you a tax.
Here's what happens to your data getting to the network for even a lightweight protocol like TCP:
This picture does not show the costs of securing your transmissions. Using technologies like SSL or NTLM requires not only additional space in messages, but also the security negotiations lead to more messages being exchanged.
For those of you using SOAP, your application data gets wrapped with an envelope, body tags, and message headers. The size of the SOAP tax depends on the number of message features you want to take advantage of that require headers. This can range from about 20 bytes on the low end to as large as you want. Each additional message-level feature tends to require about 20-40 bytes. Then, you get wrapped in TCP and IP, which require 20 bytes each for their headers. On an Ethernet network, add another 14 bytes for headers and a four-byte checksum at the end. Tomorrow, we'll look at the addressing information that accounts for most of these header bytes.
The cost for Ethernet is actually much higher than pictured. First, Ethernet requires a preamble and interframe gap to separate messages on the wire. This is going to reduce the maximum bandwidth you can get across a connection. Second, for electrical reasons, there is a whole host of strange encodings used to actually send bits around, with names like "Manchester", "4B5B", and "8B10B". The stated speed of Ethernet is with these encodings taken into account so you can ignore this part of the cost. A standard 100 megabits per second network card actually sends 125 megabits per second, but the encoding consumes a 25% overhead to improve signal quality.
You can work out the actual efficiency your application has to compute your maximum effective bandwidth from the theoretical bandwidth of the connection. Let's say you're transmitting over a 10 megabits per second network with no packet loss and roughly 40 bytes of SOAP overhead per message. The maximum size of a standard Ethernet frame is 1500 bytes. You can see with this overhead that your efficiency is only going to be around 90%, so your maximum effective bandwidth is only 9 megabits per second. If you fail to stuff every transmission with the maximum amount of data, the efficiency will drop even further. The efficiency number when you're transmitting lots of very small messages is quite scary.
Next time: How TCP/IP Works, Part 4: Demultiplexing Connections
Comments
- Anonymous
April 11, 2006
Inside each layer of the TCP/IP networking stack, there are many protocols to transmit and route information... - Anonymous
April 13, 2006
Yesterday, we looked at the tax you pay for a typical network stack. Where does all that tax go? Well,... - Anonymous
April 17, 2006
The AppDev: Something You Should Know is a great blog to read/subscribe to, it has loads of useful... - Anonymous
May 30, 2006
There are two ways to think about the representation of data on a standard Ethernet network. The first... - Anonymous
June 21, 2006
I've talked about the framing that goes on in the network stack before, but today's topic is a case where...