HTML and CSS Reference
In-Depth Information
The HTTP, TCP, and later IP layers each add a different type of header information. The
TCP and IP header information is binary data. In binary data each of the headers can be rep-
resented by the minimum number of bits—if there are only four possible values, then only
2 bits need to be used. HTTP headers are plain text, which makes them easy to read but
more verbose. The smallest possible theoretical header is a single-character label, a colon,
and a single-character value. In ASCII encoding this adds up to 24 bits. Most labels and
values are made up of several letters, and each HTTP request has several headers attached,
with the result that most HTTP requests attach between 0.7 and 2 kilobytes of headers.
This is one of the disadvantages of HTTP for data communication. If a single chat message
needs to be sent, and the message is only 20 or 30 bytes, it needs to be sent with all this
extra data.
In network performance terms we talk about throughput (or bandwidth): the amount of data
that the server can send per second. If the server is limited to a throughput of 10 kilobytes
per second, then it can deliver around 10 HTTP responses per second. If it only had to send
the chat data, it would be able to send about 330 chat messages. From a slightly different
point of view, an application based on thousands of users receiving small, real-time updates
will need 33 times as many servers if you send that data over HTTP than if you're just
sending the chat data.
Throughput is only one measure of network performance. In the next section you'll con-
sider the other key factor, latency.
D.3. Network performance metrics: latency and throughput
Throughput, the amount of raw data that can be transferred in a given time period, is only
one aspect of networking performance. The other key factor is latency : the time it takes for
a single bit of data to travel between two computers. Latency is important when you expect
to have a lot of requests, and those requests depend on one or more of the previous requests
completing.
In the previous section you learned that all the extra headers used by HTTP impact the
throughput. You have every right to wonder, then, why bother with them. One reason is
to improve latency. All of those headers include information about caching. This allows a
browser to only download a resource, such as an image or a style sheet, a single time and
Search WWH ::




Custom Search