Menu
Dev.to #systemdesign·August 18, 2026

Designing an Application-Layer Sliding Window Protocol for High-Latency Networks

This article details the architectural challenges of maintaining reliable telemetry in high-latency, unreliable network environments, specifically with Windows CE devices. It explains how standard TCP/IP limitations like window exhaustion and head-of-line blocking fail in these scenarios. The solution presented is a custom application-layer sliding window protocol over UDP to ensure timely data delivery by prioritizing freshness over absolute completeness.

Read original on Dev.to #systemdesign

The Challenge: TCP Limitations in High-Latency Environments

When building systems for unreliable networks, especially with embedded devices like the Windows CE device mentioned, standard Transmission Control Protocol (TCP) can become a bottleneck. The article highlights how TCP Window Exhaustion occurs when acknowledgments (ACKs) are delayed due to high Round Trip Time (RTT), causing the sender's buffer to fill up and cease transmission. This is exacerbated by Head-of-Line (HoL) Blocking, where the retransmission of a lost packet delays all subsequent packets, even if they've already arrived, due to TCP's strict in-order delivery guarantee.

⚠️

Why TCP Configuration Isn't Always the Answer

Architects often consider tuning OS-level TCP parameters. However, in constrained environments like Windows CE, this is often infeasible due to: 1. Inflexibility: Registry changes might require reboots, preventing dynamic adjustment. 2. Memory Constraints: Large TCP buffers can exhaust limited RAM on embedded devices. 3. Application Requirements: TCP's strict ordering is unsuitable for real-time data where freshness is paramount, and old data is irrelevant.

The Solution: Custom Application-Layer Sliding Window Protocol

To overcome TCP's limitations, the team implemented a custom sliding window protocol directly at the application layer, using UDP as the underlying transport. This approach gives the application full control over packet pacing, ordering, buffer management, and retransmission policies, decoupling application state from the OS network stack.

  1. Sequence Numbering & Logical Window: Each packet is assigned a unique sequence ID. A defined transmit window (W) allows the sender to continuously send packets up to `Sequence ID + W` without immediate ACK, buffering them until acknowledged.
  2. Cumulative and Selective Feedback: The receiver sends lightweight, periodic cumulative ACKs (e.g., "I have processed up to Sequence ID X"). This advances the sender's window, freeing buffer space and allowing new transmissions.
  3. Smart Frame Dropping: In severe latency, if older frames aren't acknowledged, the application can proactively drop the oldest unacknowledged frames, update the window, and transmit fresh data. The receiver is designed to gracefully handle these sequence gaps (e.g., via interpolation), ensuring continuity rather than connection drops.

Architectural Takeaways

This case study underscores critical lessons for designing robust distributed systems, especially at the edge or with IoT:

  • Match Protocol to Domain: Understand if your application prioritizes timeliness (like live streaming, gaming, or patient vitals) over absolute completeness. If so, TCP might not be the right fit.
  • Design Explicit Application-Layer Backpressure: Never let external network conditions dictate internal application memory. Implement clear policies (queue, drop, throttle) for handling data when the network is congested.
  • Decouple App Availability from Network Stability: Implement separate heartbeat mechanisms to check endpoint liveness. A delayed packet should not automatically mean a dead node; the application should be resilient to transient network issues.
sliding window protocolUDPTCPnetwork protocolshigh latencyembedded systemstelemetryreal-time data

Comments

Loading comments...