Fundamentals 5 min read

Why Your Network Fluctuates: A Plain‑English Deep Dive into TCP Sliding Window and Congestion Control

The article explains why network speed can be inconsistent by breaking down TCP's two core mechanisms—sliding window for flow control and congestion control for traffic management—using simple scenarios, step‑by‑step workflows, and interview‑ready summaries.

liandk
liandk
liandk
Why Your Network Fluctuates: A Plain‑English Deep Dive into TCP Sliding Window and Congestion Control

TCP core mechanisms

TCP reliability relies on two mechanisms: sliding window (flow control) and congestion control (network traffic management).

Sliding window (flow control)

Scenario: a sender with high bandwidth and a receiver with limited processing capability. If the sender transmits without restraint, the receiver’s buffer overflows, causing packet loss and request errors.

Workflow

After the connection is established, the receiver advertises the amount of free buffer space (the window size).

The sender transmits no more than the advertised window.

When the receiver processes data, it frees buffer space and updates the window size.

The sender slides the window forward and continues sending according to the updated size.

Key points

Flow control resolves the “send fast, receive slow” mismatch.

Dynamic adjustment: send more when the receiver is idle, send less when busy, avoiding bandwidth waste.

Prevents packet loss by avoiding buffer overflow at the source.

Zero‑window pitfall

If the receiver’s buffer becomes full, it advertises a window size of 0 . The sender stops transmitting and waits, which appears as a timeout or stalled data.

Congestion control (network traffic manager)

Even when both endpoints are fast, a congested link can cause delays and loss. TCP adjusts the transmission rate through four phases.

1. Slow start

When a connection is first opened, TCP begins with a small congestion window and increases it exponentially, probing the network capacity without overwhelming it.

2. Congestion avoidance

After the congestion window reaches a threshold, growth switches to linear increase, stabilizing the rate to prevent sudden traffic spikes.

3. Fast retransmit

Upon detecting a few lost packets (e.g., via duplicate ACKs), TCP retransmits the missing packets immediately without waiting for a timeout.

4. Fast recovery

After confirming congestion, TCP reduces the sending rate slightly, then gradually ramps up again once the network clears, avoiding a full reset to slow start.

High‑frequency interview summary

Sliding window = flow control; prevents receiver buffer overflow.

Congestion control = network speed management; prevents link‑wide congestion.

Variable network speed is a normal TCP dynamic adjustment, not a bug.

Intermittent stalls or timeouts are often caused by a zero window or network congestion.

TCP reliability depends on rate limiting, congestion avoidance, fast retransmit, and ordered delivery.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

TCPNetwork PerformanceFlow ControlSliding WindowCongestion Control
liandk
Written by

liandk

Seasoned Java and mobile developer with years of experience, specializing in mini‑programs, public accounts, and full‑stack front‑end development. In the AI era, I continuously learn to broaden my knowledge and evolve. I revived a public account I started a decade ago during a dessert‑startup venture, using code as a vessel and knowledge as a companion. I share personal projects, technical articles, programming tips, and growth insights—let’s improve together and set sail.

0 followers
Reader feedback

How this landed with the community

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.