Accounting Review---Segmentation/Sharding

Fragmentation occurs at the transport layer, usually TCP segmentation; fragmentation occurs at the network layer, and the IP layer transmits data in fragments.

Fragmentation-MTU (Maximum Transmission Unit, Maximum Transmission Unit)

Let me talk about the concept of MTU first. MTU means that the data link layer has a limit on the size of data frames, and this limit is called MTU.

If the IP layer has a piece of data to be transmitted, and the size of this data exceeds the MTU, then the IP layer will fragment the data according to the MTU, and then transmit it piece by piece.

After the receiver receives these pieces of data, it will be reinstalled by the receiver's IP layer to form a whole piece of data.

Using UDP can easily lead to fragmentation, while using TCP generally avoids fragmentation. This is because TCP has its own way of fragmentation.

Network communication, do everything possible to avoid IP fragmentation! Why? Because the host and router responsible for IP fragmentation will spend a lot of CPU resources to process fragmentation, and the corresponding receiver also needs to spend a lot of resources to reorganize.

Segmentation-MSS (Maxitum Segment Size, the maximum segment size)

This is a concept in TCP, which refers to the maximum data segment that a TCP data packet can transmit at a time. This is defined according to the current network transmission rate and transmission capacity. Before each TCP transmission, the sender and the receiver will agree on an MSS according to the situation, and then the sender will divide an entire data stream into multiple segments based on the MSS, and then transmit it segment by segment.

Summary: UDP will not be fragmented, so IP will be fragmented; TCP will fragment by itself, so IP fragmentation is not needed.

Guess you like

Origin blog.csdn.net/why1092576787/article/details/114792040