Connected: An Internet Encyclopedia
4.2.3.12 Efficiency

Up: Connected: An Internet Encyclopedia
Up: Requests For Comments
Up: RFC 1122
Up: 4. TRANSPORT PROTOCOLS
Up: 4.2 TRANSMISSION CONTROL PROTOCOL -- TCP
Up: 4.2.3 SPECIFIC ISSUES
Prev: 4.2.3.11 TCP Traffic Patterns
Next: 4.2.4 TCP/APPLICATION LAYER INTERFACE

4.2.3.12 Efficiency

4.2.3.12 Efficiency

IMPLEMENTATION:

Extensive experience has led to the following suggestions for efficient implementation of TCP:

  1. Don't Copy Data

    In bulk data transfer, the primary CPU-intensive tasks are copying data from one place to another and checksumming the data. It is vital to minimize the number of copies of TCP data. Since the ultimate speed limitation may be fetching data across the memory bus, it may be useful to combine the copy with checksumming, doing both with a single memory fetch.

  2. Hand-Craft the Checksum Routine

    A good TCP checksumming routine is typically two to five times faster than a simple and direct implementation of the definition. Great care and clever coding are often required and advisable to make the checksumming code "blazing fast". See [TCP:10].

  3. Code for the Common Case

    TCP protocol processing can be complicated, but for most segments there are only a few simple decisions to be made. Per-segment processing will be greatly speeded up by coding the main line to minimize the number of decisions in the most common case.


Next: 4.2.4 TCP/APPLICATION LAYER INTERFACE

Connected: An Internet Encyclopedia
4.2.3.12 Efficiency