<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Shashi Bhushan Savarn</title>
    <description>The latest articles on DEV Community by Shashi Bhushan Savarn (@shashi_bsavarn_03038d7d7).</description>
    <link>https://dev.to/shashi_bsavarn_03038d7d7</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4083081%2F5b633ab8-785a-45de-bd3f-8a76d6bdc9b3.png</url>
      <title>DEV Community: Shashi Bhushan Savarn</title>
      <link>https://dev.to/shashi_bsavarn_03038d7d7</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/shashi_bsavarn_03038d7d7"/>
    <language>en</language>
    <item>
      <title>Designing a Custom Application-Layer Sliding Window Protocol for High-Latency Networks</title>
      <dc:creator>Shashi Bhushan Savarn</dc:creator>
      <pubDate>Tue, 18 Aug 2026 11:43:43 +0000</pubDate>
      <link>https://dev.to/shashi_bsavarn_03038d7d7/designing-a-custom-application-layer-sliding-window-protocol-for-high-latency-networks-4o68</link>
      <guid>https://dev.to/shashi_bsavarn_03038d7d7/designing-a-custom-application-layer-sliding-window-protocol-for-high-latency-networks-4o68</guid>
      <description>&lt;p&gt;A few years ago, my team faced a critical engineering challenge. We were managing a remote patient monitoring system where the edge telemetry device ran on Windows CE. In a pristine laboratory setting with low latency, the system was flawless. It continuously streamed vital signs (ECG, SpO2, and heart rate) to a central supervisor monitoring dashboard. &lt;/p&gt;

&lt;p&gt;However, once deployed into the field—where devices relied on erratic rural broadband, satellite links, or congested cellular towers—the system began to fail. The supervisor dashboard, sitting on a high-speed corporate network, regularly experienced connection dropouts. To the operator, it looked like the patient’s monitoring device was completely offline. In a medical environment, this wasn't just a bug; it was a critical safety risk. &lt;/p&gt;

&lt;p&gt;Here is an architectural deep dive into why standard network stacks broke down under these conditions, and how we engineered a custom, application-layer Sliding Window Protocol to stabilize the telemetry pipeline.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Root Cause: TCP Window Exhaustion &amp;amp; Head-of-Line Blocking&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When analyzing the network drops, we discovered a classic distributed systems problem: TCP Window Exhaustion compounded by Head-of-Line (HoL) Blocking, constrained by a legacy operating system.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Failure LoopThe Latency Trap:&lt;/strong&gt; When network quality degraded, the Round Trip Time (RTT) between the Windows CE device and the supervisor dashboard skyrocketed from 20ms to upwards of 2500ms.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Buffer Starvation:&lt;/strong&gt; The native TCP/IP stack in Windows CE had a small, rigidly configured window size (TcpWindowSize). Because network acknowledgments (ACKs) took so long to return across the high-latency link, the device quickly exhausted its outbound buffer. It spent all its time waiting, unable to transmit new packets.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The False-Positive Disconnect:&lt;/strong&gt; On the other end, the supervisor software saw a prolonged freeze in incoming telemetry data. Exceeding its naive timeout threshold, the dashboard assumed the remote device had crashed and abruptly dropped the socket connections.&lt;br&gt;
&lt;strong&gt;The Overhead Storm:&lt;/strong&gt; Re-establishing a dropped connection meant executing a fresh handshake and state resynchronization, which further choked the already degraded network pipe.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why We Couldn't Just "Fix the TCP Config"&lt;/strong&gt;&lt;br&gt;
A senior engineer's immediate instinct might be to tune the OS registry values or increase the TCP buffer size. As an architect, you must weigh platform limitations:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Windows CE Registry Inflexibility:&lt;/strong&gt; Modifying TcpWindowSize via the Windows CE registry requires a global reboot or driver reload. You cannot dynamically adjust it at runtime based on shifting network topologies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Memory Constraints:&lt;/strong&gt; Giving a massive TCP buffer allocation to an embedded device running on limited RAM risks kernel-level memory exhaustion (OOM), which could crash the entire medical application.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Reality of Medical Telemetry:&lt;/strong&gt; Standard TCP enforces absolute data ordering. If Telemetry Frame #2 drops, TCP halts everything (Frames 3, 4, and 5) until Frame #2 is retransmitted. In live patient monitoring, a 10-second-old heartbeat metric is stale history. We cared infinitely more about real-time continuity than perfect historical delivery.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Solution: A Custom Application-Layer Sliding Window&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;To bypass the rigid OS network layer, we decoupled our application state from standard TCP behavior by implementing a Custom Sliding Window Protocol over a lightweight, connectionless transport layer (UDP).&lt;/p&gt;

&lt;p&gt;This put packet pacing, ordering, and buffer management entirely inside our application code.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Sequence Numbering &amp;amp; The Logical Window&lt;/strong&gt;&lt;br&gt;
Every telemetry packet was stamped with a unique, monotonically increasing 16-bit integer Sequence ID. We defined a strict Transmit Window (W) in memory. The edge device was permitted to continuously blast packets ahead of time up to Sequence ID + W without waiting for an intermediate acknowledgment.                      &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Cumulative and Selective Feedback Loops&lt;/strong&gt;&lt;br&gt;
The supervisor application did not acknowledge individual frames. Instead, it sent a lightweight, periodic feedback heartbeat back to the edge device: "I have safely processed up to Sequence ID 104."&lt;/p&gt;

&lt;p&gt;Upon receiving this cumulative acknowledgment, the Windows CE device would instantly "slide" its window base forward to 105, freeing up the older memory blocks and clearing room to transmit frames 105 through 108.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Smart Frame Dropping&lt;/strong&gt;&lt;br&gt;
If the network latency grew too severe and the transmit window slammed shut (e.g., frame 101 was never acknowledged, but 102, 103, and 104 were sent), our application layer executed a Priority Drop.&lt;br&gt;
Instead of freezing the UI, the device cleared out the oldest unacknowledged frames from the buffer, updated its window base explicitly, and filled the next window slots with fresh, real-time vital signs. The supervisor dashboard was programmed to gracefully handle missing sequence gaps by interpolating the graph line, rather than panicking and dropping the connection.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Architectural Lessons for Senior Engineers&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This project underscored a vital lesson that senior developers shifting into architecture frequently overlook: The operating system and the network stack are not magical boxes that solve every problem for you.&lt;/p&gt;

&lt;p&gt;When designing edge, IoT, or critical distributed systems, keep these architectural paradigms in mind:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Match the Protocol to the Domain Domain:&lt;/strong&gt; TCP guarantees delivery, but it does not guarantee timeliness. If your application values the freshness of data over absolute completion (like live video, gaming, or patient vitals), native TCP will eventually fail you on poor networks.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Design Explicit Application-Layer Backpressure:&lt;/strong&gt; Never let an external network condition dictate your internal application memory allocation. If the network clogs, your system must have a deterministic policy for what to do with incoming data (Queue it, Drop it, or Throttle the producer).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Decouple App Availability from Network Stability:&lt;/strong&gt; The supervisor application shouldn't equate a delayed packet with a dead node. Build smart heartbeat mechanisms that check for endpoint liveliness separately from the primary data ingestion streams.&lt;/p&gt;

&lt;p&gt;Have you ever had to build a custom application-layer protocol to conquer hardware or network constraints? Let’s talk about your edge architecture experiences in the comments below!&lt;/p&gt;

</description>
      <category>architecture</category>
      <category>networking</category>
      <category>softwareengineering</category>
      <category>systemdesign</category>
    </item>
    <item>
      <title>Predicting CPU Spikes</title>
      <dc:creator>Shashi Bhushan Savarn</dc:creator>
      <pubDate>Tue, 18 Aug 2026 11:09:47 +0000</pubDate>
      <link>https://dev.to/shashi_bsavarn_03038d7d7/predicting-cpu-spikes-2355</link>
      <guid>https://dev.to/shashi_bsavarn_03038d7d7/predicting-cpu-spikes-2355</guid>
      <description>&lt;p&gt;&lt;strong&gt;Predictive System Health Checks: What I Learned Testing ARIMA, SARIMA, and Prophet on Infrastructure Metrics&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When building a system health check layer, knowing the current CPU, memory, or disk usage is only half the battle. If your dashboard says "CPU is at 85%," you are missing critical context. Is that a normal Tuesday morning spike? Or is it a runaway process that will crash the server in twenty minutes?&lt;/p&gt;

&lt;p&gt;To build an intelligent, predictive health check layer for my application, I decided to move past reactive thresholds. I ran a series of head-to-head experiments using three heavy hitters in time-series forecasting: ARIMA, SARIMA, and Facebook Prophet.&lt;/p&gt;

&lt;p&gt;I tested them against diverse, real-world infrastructure shapes—ranging from daily 9-to-5 spikes to slow-burning memory leaks.&lt;br&gt;
Here is a deep dive into what worked, what failed, and how data frequency and history length completely change the game.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Tech Stack &amp;amp; Test Dataset Shapes&lt;/strong&gt;&lt;br&gt;
To see where each model shined or sputtered, I evaluated them on three core infrastructure metrics: CPU (highly volatile), Memory (gradual/stepped), and Disk Space (linear growth).&lt;br&gt;
I fed these metrics into three statistical frameworks:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;ARIMA (Autoregressive Integrated Moving Average)&lt;/strong&gt;: The classic baseline. Best for short-term, non-seasonal trends.&lt;br&gt;
&lt;strong&gt;SARIMA (Seasonal ARIMA)&lt;/strong&gt;: ARIMA's older sibling. It adds seasonal parameters to capture repeating cycles (like a 24-hour day).&lt;br&gt;
&lt;strong&gt;Prophet&lt;/strong&gt;: An additive model optimized for business time series with strong seasonal patterns and multiple curve shifts.&lt;/p&gt;

&lt;p&gt;I threw five distinct data anomalies and patterns at these models to see how they would react:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Daily Workday Spike:  (High usage 9-to-5, dead at night)&lt;/li&gt;
&lt;li&gt;Gradual Linear Creep: (Slow, steady memory or disk growth)&lt;/li&gt;
&lt;li&gt;Once-a-Month Spike:   (Monthly cron jobs or payroll processing)&lt;/li&gt;
&lt;li&gt;Random Spike:         (Unpredictable traffic/DDOS bursts)&lt;/li&gt;
&lt;li&gt;Smooth Wave Pattern:  (Usual gradual increase/decrease)&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;&lt;strong&gt;Performance Breakdown: Which Model Won?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pattern 1: Gradual Increases &amp;amp; Memory Creeps&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Winner:  Prophet&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;The Reality&lt;/strong&gt;: Prophet knocked this out of the park. When an application has a slow memory leak or a steady growth in disk usage, Prophet isolates the structural trend line beautifully from day-to-day noise. It handles non-linear growth curves without overreacting.&lt;br&gt;
&lt;strong&gt;The Losers&lt;/strong&gt;: ARIMA and SARIMA tend to "flatline" too early or get heavily distorted by minor short-term fluctuations, missing the macro-trajectory of a slow-burn failure.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pattern 2: Daily Workday Spikes (Hourly Data)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Winner: SARIMA&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;The Reality&lt;/strong&gt;: When infrastructure metrics strictly adhere to human schedules (e.g., traffic surges at 9 AM and drops at 6 PM), SARIMA dominates. Once you properly configure its seasonal period parameter (s=24 for hourly data), it locks onto the daily pattern with razor-sharp precision.&lt;br&gt;
&lt;strong&gt;The Runner-Up&lt;/strong&gt;: Prophet performs adequately here, but it tends to slightly smooth out the sharp peaks, making its maximum capacity forecasts a bit too conservative for infrastructure alerting.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pattern 3: Once-a-Month Spikes&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Winner:  None (Structural Failure)&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;The Reality&lt;/strong&gt;: Every model failed here unless given years of data. If your dataset only spans 3 months, a monthly cron job or billing cycle only appears 3 times. Statistical models cannot confidently separate a 3-occurrence spike from a random outlier. They either ignore the monthly spike entirely or treat it as a trend disruption.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Pattern 4: Random Spikes &amp;amp; Traffic Bursts&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;Winner: None&lt;/strong&gt;&lt;br&gt;
&lt;strong&gt;The Reality&lt;/strong&gt;: Time-series forecasting models assume the future is a function of the past. A completely random spike (like a sudden micro-burst of traffic or a rogue script execution) breaks these models completely.&lt;br&gt;
&lt;strong&gt;The Danger&lt;/strong&gt;: ARIMA and SARIMA are especially vulnerable here; they often interpret a massive random spike as the beginning of a major upward trend, leading to wild, panicked forecasts for the subsequent hours.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The Hidden Variable: Data Frequency vs. History Length&lt;/strong&gt;&lt;br&gt;
One of my biggest takeaways was that the math doesn't matter if your data granularity is wrong. I observed a direct trade-off between the frequency of data collection and the historical window used for training:&lt;br&gt;
Scenario A: Every hour for the last 1 week&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for&lt;/strong&gt;: Identifying intra-day cycles and immediate next-hour alerts.&lt;br&gt;
&lt;strong&gt;The Problem&lt;/strong&gt;: The model becomes blind to long-term trends. It assumes the world resets every Sunday night. If your memory is gradually creeping up week-over-week, this training window will completely miss it.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Scenario B: Every 12 hours for the last 3 months&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Best for&lt;/strong&gt;: Macro-capacity planning, disk space runway prediction, and tracking monthly baselines.&lt;br&gt;
&lt;strong&gt;The Problem&lt;/strong&gt;: You lose all fine-grained peak visibility. A critical, high-intensity CPU spike that lasts for 2 hours gets completely smoothed out and averaged into oblivion. The model will tell you your system is perfectly fine when it is actually choking during peak hours.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Practical Engineering Takeaways&lt;/strong&gt;&lt;br&gt;
If you are looking to build predictive alerts or trend graphs into your own applications, save yourself some time and follow these engineering rules:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1. Decouple Your Models:&lt;/strong&gt; Do not use a single model for your system health dashboard. Use Prophet to track slow-moving variables like disk allocation and memory creep. Use SARIMA to forecast highly cyclical, usage-dependent patterns like CPU spikes.&lt;br&gt;
   &lt;strong&gt;2. Sanitize Your Data Before Training:&lt;/strong&gt; Because random spikes break statistical models, you must clean your training data. Apply a rolling median filter or a simple outlier truncation step to strip out random 1-minute 100% CPU spikes before feeding the data to the model. Otherwise, your model will spend days forecasting "ghost" anomalies.&lt;br&gt;
   &lt;strong&gt;3. Align Granularity to the Goal:&lt;/strong&gt; If you want to prevent out-of-memory (OOM) crashes today, train an hourly model on a 14-day history. If you want to know when to upgrade your AWS EBS volumes, train a 12-hour aggregated model on a 6-month history.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What are you using?&lt;/strong&gt;&lt;br&gt;
Building an automated predictive system is iterative, and no statistical model fits perfectly out of the box without tweaking parameters.&lt;br&gt;
Have you tried building time-series forecasting into your DevOps or application monitoring stack? Do you lean toward classic stats models, or have you migrated to deep learning solutions? Let's discuss in the comments below!&lt;/p&gt;

</description>
      <category>ai</category>
    </item>
  </channel>
</rss>
