In the last week of September, a regional fiber outage took down the backhaul of two GSM operators at once, and our 1,800 devices along the Aydın-Denizli corridor went dark simultaneously at 11:04 a.m. The outage lasted exactly 6 hours and 12 minutes. Our customers were food companies doing cold chain tracking; the data from those 6 hours wasn't "nice to have," it was a record they were required to produce in audits. When the network came back at 5:16 p.m., the real test began: 1,800 devices, each with an average of 4,400 pending measurements, all started talking at once. That evening we learned that edge buffering is two separate exams — accumulating and draining — and we had only studied for the first.
The Data Was There; the Ordering Was a Disaster
The accumulation side actually worked well. Our devices had a store-and-forward layer: when there was no connection, measurements were written to local flash, and when the connection returned, they were sent. We handled the 6-hour outage comfortably in terms of capacity, because we had designed the buffer size for a worst case of 72 hours. The problem was in the draining strategy. The firmware sent the queue in FIFO order rather than LIFO — the right decision on paper, since chronology is preserved. But one detail had been overlooked: while draining the buffer, the device was appending live measurements to the back of the queue. Draining a 4,400-message queue at 2G speeds took more than 40 minutes, and during that whole time the operations team couldn't see the current state of the devices. In cold chain, 40 minutes of blindness is not something you can explain to a customer who has just been through 6 hours of blindness.
The first fix was small conceptually but big in impact: we split the queue in two. Live data always goes out immediately over the priority channel; the historical buffer drains in the background, over a separate topic, using whatever bandwidth is left. As soon as the network is back, operations sees current temperatures within 30 seconds, while the history fills in quietly. This split has its counterpart in the backend too: the live channel flows into the alarm engine, while the historical channel goes straight into the time-series database — historical data doesn't trigger alarms again on its way back. On the day of the outage, as the "temperature rose to 9 degrees" measurements from 6 hours earlier flowed back in, the alarm engine generated 700-odd stale alarms; the on-call engineer's phone locked up in the most literal sense.

If Everyone Talks at Once, Nobody Gets Heard
The second test was on the backend side. The synchronized return of 1,800 devices hit our ingestion pipeline, which normally processes 120 messages per second, with a peak of 3,800 messages per second. The MQTT broker handled it, but the write layer behind it didn't: the service doing batch inserts into TimescaleDB exhausted its connection pool and started returning 502s, messages piled up at the consumer, and lag hit 25 minutes. The irony was that we had kept the data perfectly safe in the field for 6 hours, only to face the risk of dropping it in our own data center.
Our lesson here was that the thundering herd isn't just a reconnect problem. We built the solution at both ends at once. On the device side: the buffer drain rate is now tied to a "tempo" parameter that comes from the server. When the backend is congested, a single retained message published through the broker lets us tell the entire fleet "drop historical draining to 1 message per second"; in normal times this limit is 10. In addition, before it starts draining, each device waits for a delay of 0-300 seconds derived from its own ID; the return wave is no longer a steep wall but a broad hill. On the backend side: we put a Kafka-like buffer in front of the historical channel (at the time we used Redis Streams, for budget reasons); the write service consumes at its own pace, and the queue absorbs the peak load.

The Silent Death of Flash and the Lies of Timestamps
Buffering has two more costs that nobody puts on a dashboard. The first is flash lifespan. In the initial design, we wrote each measurement to flash individually as it arrived; one measurement a minute is 1,440 writes a day, and multiplied by sector erase cycles on NOR flash, the buffer region on some devices was dying within two years. A dead buffer is insidious: the device keeps working, live data keeps flowing, but when an outage comes, it can't store anything — meaning the failure surfaces exactly when you need it. The fix: collect measurements in RAM in 15-minute blocks, write them to flash in one go as CRC-checked records, and add wear-leveling to the region. Writes dropped to 96, and in projections the buffer's lifespan now exceeds the device's. The price: a risk of losing at most 15 minutes of data on a sudden power loss. We balanced that by writing critical alarm measurements immediately without waiting for the block — data classification came up yet again.
The second cost is time. The value of data accumulated during an outage is only as good as the accuracy of its timestamps. Our devices synced via NTP; but what about the clock on a device that spent 6 hours without a network and then also rebooted after a power cut? On three devices with weakened RTC batteries, the clock had reset to January 1, 2000, and those devices had stamped the data they collected during the outage as 26 years in the past. The database silently accepted it; the one who noticed was a customer pulling an audit report. Now every buffer record has two fields: the device's wall clock and a monotonic counter that counts from boot. When the device returns to the network and learns the real time, the backend recalculates the correct times backward using the monotonic counter. We stopped trusting the RTC; the RTC is now just a hint.
We also used the occasion to put compression on the table. Since the historical channel is tolerant of latency anyway, we started packaging measurements on the device in 15-minute blocks using delta encoding and light compression before sending them; the average payload dropped from 96 bytes to 14 bytes per measurement. This paid off in three ways: the drain time for a 6-hour buffer fell from 40 minutes to 9 minutes, the monthly GSM data bill dropped noticeably, and the number of messages hitting the backend — one message per block — fell to a fortieth. We didn't touch the live channel; there, having a single measurement on screen in 2 seconds is worth more than any efficiency gain.

A Buffer Isn't a Feature; It's a Contract
After that outage, a measurable clause went into our customer contracts: "No data loss during network outages of up to 72 hours; when the network returns, live visibility is restored within 60 seconds and full historical integrity within 4 hours." Being able to write that sentence is the summary of all the engineering behind it — queue separation, tempo control, wear-leveling, monotonic time. And every quarter we run an "outage drill": we remotely shut off the SIMs of 50 randomly selected devices for 8 hours and measure their return behavior. In the last drill, historical integrity was complete in 2 hours and 40 minutes, with zero stale alarms generated.
In brochures, edge buffering is a one-sentence feature: "the device stores data offline." In the field, it's the intersection of at least five separate engineering decisions: what to store, how to write it, when to send it, how fast to send it, and which clock to stamp it with. The wrong default for each of these decisions stays invisible until the day of the outage. If your own fleet is in a state of "we support offline, but the recoveries are always painful," write to us here; I'll share our drill scenario and queue separation design as they are, because we've already paid the expensive price of learning these things.
A screenshot of the dashboard from that September day of the fiber outage still sits at the top of our wiki. Beneath it is a single line: "We didn't lose any data. But for six hours, we didn't know that." Fine-tuning edge buffering is all about never having to write that sentence again.