IBM REDP-4285-00 User Manual

Page of 170
4285ch01.fm
Draft Document for Review May 4, 2007 11:35 am
26
 
Linux Performance and Tuning Guidelines
1.5  Network subsystem
The network subsystem is another important subsystem in the performance perspective. 
Networking operations interact with many components other than Linux itself such as 
switches, routers, gateways, PC clients etc. Though these components may be out of the 
control of Linux, they have much influence on the overall performance. Keep in mind that you 
have to work closely with people working on the network system.
Here we mainly focus on how Linux handles networking operations.
1.5.1  Networking implementation
The TCP/IP protocol has a layered structure similar to the OSI layer model. The Linux kernel 
networking implementation employs a similar approach. Figure 1-23 illustrates the layered 
Linux TCP/IP stack and quick overview of TCP/IP communication.
Figure 1-23   Network layered structure and quick overview of networking operation
Linux uses a socket interface for TCP/IP networking operation as well as many UNIX systems 
do. The socket provides an interface for user applications. We will take a quick look at the 
sequence that outlines the fundamental operations that occur during network data transfer.
1. When an application sends data to its peer host, the application creates its data.
2. The application opens the socket and writes the data through the socket interface.
3. The 
socket buffer
 is used to deal with the transferred data. The socket buffer has reference 
to the data and it goes down through the layers.
4. In each layer, appropriate operations such as parsing the headers, adding and modifying 
the headers, check sums, routing operation, fragmentation etc. are performed. When the 
socket buffer goes down through the layers, the data itself is not copied between the 
layers. Because copying actual data between different layer is not effective, the kernel 
avoids unnecessary overhead by just changing the reference in the socket buffer and 
passing it to the next layer.
5. Finally the data goes out to the wire from network interface card. 
6. The Ethernet frame arrives at the network interface of the peer host
IP
TCP/UDP
INET socket
BSD socket
Device
Datalink
Device driver
NIC
Process
sk_buff
Ethernet
Header
IP Header
TCP/UDP 
Header
Data
IP
TCP/UDP
INET socket
BSD socket
Device
Datalink
Device driver
NIC
Process