Fundamentals 17 min read

Why TCP Does Not Guarantee No Packet Loss: Detailed Walkthrough of Data Packet Transmission and Common Loss Scenarios

This article explains how TCP packets travel from user space to the destination, highlights typical points where packet loss can occur—including connection establishment, flow‑control queues, NIC buffers, and end‑to‑end network hops—and shows how to diagnose and mitigate these issues using Linux tools.

IT Services Circle
IT Services Circle
IT Services Circle
Why TCP Does Not Guarantee No Packet Loss: Detailed Walkthrough of Data Packet Transmission and Common Loss Scenarios

Data Packet Transmission Process

We simplify end‑to‑end communication using TCP: a message is copied from the chat application's user space to the kernel send buffer, passes through the transport, network, and data‑link layers, is queued by qdisc , sent to the NIC, traverses multiple routers and switches, and finally arrives at the destination NIC.

Common Packet Loss Scenarios

Loss During Connection Establishment

TCP uses a three‑way handshake, creating a half‑open queue and then a full‑open queue. If these queues overflow, new SYN packets are dropped, causing connection‑establishment failures. You can view overflow counts with netstat -s :

# 全连接队列溢出次数
# netstat -s | grep overflowed
    4343 times the listen queue of a socket overflowed

# 半连接队列溢出次数
# netstat -s | grep -i "SYNs to LISTEN sockets dropped"
    109 times the listen queue of a socket overflowed

Flow‑Control (qdisc) Loss

When the transmission queue length ( txqueuelen ) is too short, packets are dropped. Use ifconfig to view the queue length and adjust it if necessary:

# ifconfig eth0 txqueuelen 1500

NIC Buffer (RingBuffer) Loss

If the NIC’s receive RingBuffer is too small, overflow occurs. Check overflow statistics with ethtool -S and enlarge the buffers with ethtool -G :

# ethtool -S eth0 | grep rx_queue_0_drops
# ethtool -g eth0
# ethtool -G eth0 rx 4096 tx 4096

Receive Buffer Loss

TCP sockets have configurable send and receive buffers. Their sizes are shown by sysctl net.ipv4.tcp_rmem and sysctl net.ipv4.tcp_wmem . When the receive buffer is full, the TCP window becomes zero (win=0), the sender stops sending, and further packets may be dropped.

# 查看接收缓冲区
# sysctl net.ipv4.tcp_rmem
net.ipv4.tcp_rmem = 4096    87380   6291456

# 查看发送缓冲区
# sysctl net.ipv4.tcp_wmem
net.ipv4.tcp_wmem = 4096    16384   4194304

End‑to‑End Network Loss

Use ping to see overall packet loss and mtr (or mtr -u ) to locate loss on each hop of the path.

# ping baidu.com
# mtr -r baidu.com
# mtr -u -r baidu.com

Why TCP Does Not Guarantee No Packet Loss

TCP guarantees reliability only up to the transport layer. After a packet reaches the receiver’s TCP receive buffer, the application must read it. If the app crashes or the buffer overflows, the data is lost even though TCP’s retransmission succeeded.

Summary

Data travels through many layers and devices; packet loss can happen at any point.

TCP’s retransmission handles most loss, but application‑level reliability must be implemented by the app.

Use kernel and network tools (netstat, ifconfig, ethtool, sysctl, ping, mtr) to diagnose and mitigate loss.

TCPLinuxNetworkingSocketethtoolpacket lossqdisc
IT Services Circle
Written by

IT Services Circle

Delivering cutting-edge internet insights and practical learning resources. We're a passionate and principled IT media platform.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.