Call Phone +8618073152920 Hotline: +8618073152920
Call Phone +8618073152920
English
CONTACT US/ CONTACT US
Consumer hotline +8618073152920
Changsha Zoko Link Technology Co., Ltd.

Email:Arvin@niubol.com

WhatsApp:+8615367865107

Address:Room 102, District D, Houhu Industrial Park, Yuelu District, Changsha City, Hunan Province, China

Position:Home >> Blogs >> Product knowledge

Product knowledge

IoT Monitoring Platform: Handle Late and Duplicate Packets

Time:2026-11-26 14:30:00 Popularity:4

Two records arrive at the database one after the other. Both carry the same device ID, the same sequence number and the same device time. Should the IoT monitoring platform display one row or two? The answer decides the deduplication key, and that key must be fixed before any chart, alarm or backfill rule is configured.

The deduplication key an IoT monitoring platform needs

The answer to the opening question is one row. A second arrival that matches on all three fields is a retransmission of the same measurement, not a new observation. Treating it as a second row inflates counts, biases averages and can trigger repeated alarms. The IoT monitoring platform must collapse the pair at write time, before any downstream consumer sees it.

RTU Data collector utilizes cellular network to connect your network devices and serial port devices

Figure 1. RTU Data collector utilizes cellular network to connect your network devices and serial port devices.

The key has three fields. Device ID identifies the source. Sequence number is the sender's counter for that source. Device time is the timestamp stamped by the source, not by the server. A record is a duplicate only when all three match. Matching on device ID alone would merge measurements taken minutes apart; matching on device ID plus sequence alone would collide after a counter reset.

Sequence numbers are assigned per device, so they are not globally unique. Two devices can both report sequence 14,281 in the same minute. Device time alone is also unsafe because several devices may stamp the same minute. Only the three-field tuple is unique across a mixed fleet.

Store the tuple as a unique index and reject the second insert. Keep the first accepted row and record the rejection as an audit event: it tells you a retransmission occurred and on which link. What it must not do is become a second measurement.

Event time orders the chart; arrival time audits the pipeline

A late packet is a frame whose device time is older than frames already stored. If the platform sorts by arrival time, that frame appears at the end of the series and the chart shows a false dip or spike at the current moment. Sorting by device time places the same frame at its correct position in the timeline. The ordering field is therefore device time.

Arrival time is still required, but for a different job. It answers when the record physically reached the database, which is what you need to measure link delay, detect a stuck writer and prove that a late packet was accepted inside its window. Do not use it as the chart's x-axis.

Field Layer Role Example value Unit / condition
device_id key source identity 12 devices, IDs 01–12 count
sequence_no key sender counter 14,281 per device
device_time key + order event sort key 06:35:00 device stamp
arrival_time audit ingestion stamp 06:41:12 server clock
ingest_delay audit arrival minus device 372 s
quality_flag payload retained status OK / LATE enum
writer_id audit source of write writer-03 label
window_bucket audit backfill class 6 h

The pairing is deliberate. Device time controls what the user sees; arrival time controls what the operator can prove. A late packet that lands 372 seconds after its device time is still plotted at 06:35, but the 372-second gap is preserved for audit. Two questions, two fields.

A 12-device day: 3,456 frames and 17 duplicates

Here is a calculation you can reproduce by hand. Assume 12 devices, one frame every 5 minutes and a 0.5% retransmission rate. Illustrative calculation based on assumed site values, not a measured field record. The 0.5% figure is a typical engineering reference value; confirm the rate on your own links.

Item Value Unit Formula / condition
Devices 12 units assumed count
Frame interval 5 min assumed
Frames per device per day 288 frames/day 1,440 min ÷ 5
Unique frames per day 3,456 frames/day 12 × 288
Retransmission rate 0.5 % typical engineering reference value
Duplicate frames per day 17.28 (≈17) frames/day 3,456 × 0.005
Arriving frames per day 3,473 frames/day 3,456 + 17
Accepted unique rows 3,456 rows/day deduplicated total
Late window 6 h assumed
Frames in window per device 72 frames 360 min ÷ 5
Backfill slots per window 864 records 12 × 72
Audit fields per record 2 fields device time + arrival time

The arithmetic gives three numbers to design against. The IoT monitoring platform must ingest roughly 3,473 arriving frames per day, store 3,456 unique rows and discard about 17 duplicates. A buffer sized only for 3,456 frames will still see 17 extra writes; size the write path for the arriving count, not the unique count. Twelve devices at a 5 min cadence produce 288 frames per device per day before retransmissions.

The 864 backfill slots are a capacity figure, not a prediction that 864 late packets will appear. It is the maximum number of records a six-hour window can hold across 12 devices at this cadence. A 6 h window contains 360 min, so each device contributes 72 frames and 12 devices contribute 864 slots. Add devices or shorten the interval and both numbers scale linearly.

Backfill windows and overwrite rules inside six hours

A backfill window is the maximum age, measured in device time, at which a late packet is still allowed to change stored data. Inside a 6 h window, a frame stamped at 06:35 that arrives at 12:20 is old enough to be late but young enough to insert. Beyond 6 h, the same frame is rejected or written to a separate exception store.

Industrial IoT Edge Gateway | 4G, RS485, Modbus

Figure 2. Industrial IoT Edge Gateway — 4G, RS485, Modbus.

Insert and overwrite are different decisions. If the time slot is empty, the late packet fills it. If the slot already holds a row from a different sequence number, the platform needs an overwrite rule. One rule is last-writer-wins by arrival time, but that lets a late correction silently replace a value already shown on a dashboard. Another is first-accepted-wins, with the conflicting late frame retained as a correction record.

Whatever the rule, it must be deterministic and logged. Record which value was kept, which was superseded, and both arrival times. A 6 h backfill window with an undocumented overwrite rule produces numbers nobody can defend when a client asks why yesterday's reading changed. State the window in hours and in device time before enabling backfill.

An IoT monitoring platform should expose the window as an explicit parameter, not as an implicit property of a buffer. State it in hours, state it in device time, and state what happens at the boundary. Six hours is a typical engineering reference value here; the right figure depends on how long your links can actually be delayed.

When several writers target one measurement point

A single measurement point can receive writes from more than one process. A real-time writer handles live frames. A backfill writer replays late packets. A correction writer applies manual fixes. Without a rule, these processes replace each other and the stored value depends on timing rather than intent.

Resolve conflicts by priority, not by arrival order. Give each writer a rank: live frames outrank backfill, and backfill outranks a manual correction unless that correction is explicitly flagged as authoritative. A writer_id field on every row makes the decision auditable. When two writers claim the same device ID, sequence and device time, the higher-priority write wins and the lower-priority row stays as history.

Tie-breaks need their own rule. If two writers share a priority, compare arrival time and keep the earlier write, because the earlier arrival is closer to the event. Do not leave the tie to database row order. Non-deterministic tie-breaks make the same input produce different datasets after a restart.

The conflict rule belongs to the deduplication contract. Inside the IoT monitoring platform, the unique index that collapses retransmissions and the priority rule that settles writer collisions should be defined together, then tested with a small replay that drives two writers at the same record.

Quality flags travel with the record

A quality flag describes the condition of a measurement, not the condition of a dashboard. It must be stored beside the value it describes. If a late packet is accepted at 372 seconds, the flag that says LATE belongs on that row, not in a log that gets rotated away.

Keep the flag as a field, not as a note in a separate table. Common flags include OK, LATE, RETRANSMIT_IGNORED and OUT_OF_WINDOW. Each flag answers a specific question during audit: was this row on time, was a duplicate discarded, did a frame arrive after its window closed? Preserving the flag lets a reader filter a series without guessing.

Do not strip flags when data is aggregated. If an hourly mean is stored without the count of late or duplicate-contributed records, the downstream user cannot judge whether the mean is trustworthy. Store the mean together with the number of source records and the number of discarded duplicates.

Quality flags also settle disputes. When a client questions a reading, the flag plus the arrival time plus the writer ID explain how the value entered the platform, provided the flag was written at ingest and was not replaced by a later cleanup job.

Where these rules fail: clock drift and sequence wrap

The three-field key and the six-hour window rely on two assumptions. Device time must be comparable across devices, and sequence numbers must keep increasing. Both assumptions can break, and the rules stop working when they do.

Automatic weather stations supplying measurements to a monitoring platform

Figure 3. Automatic weather stations supplying measurements to a monitoring platform.

Clock drift crossing the window. If a device clock gains, say, 10 min per day — a typical engineering reference value — its device time eventually leads the server by more than the window. A 6 h window is crossed after about 36 days at that drift rate. A frame stamped in the future may be rejected as out of range, or a genuinely late frame may appear on time. Cross-device comparison becomes invalid once drift exceeds the window. Correcting drift is a clock problem, not a deduplication problem; the IoT monitoring platform should flag it rather than silently re-stamp records.

Sequence wrap. Counters are finite. An 8-bit field wraps at 255, a 16-bit field at 65,535. At one frame every 5 min, a 16-bit counter repeats after about 227 days of continuous logging. After a wrap, sequence numbers repeat and the three-field key can collide on two different measurements in the same device-time slot. The key is unique only within a counter epoch. Add an epoch to the key, or use a device time precise enough that two wrapped frames never share a stamp.

There are quieter limits. A zero retransmission rate makes duplicate handling irrelevant. A link with no late packets makes the window irrelevant. Do not add complexity the site does not need. Define the boundary, test it, and write down what happens outside it.

FAQ

Q1. If two records share device ID, sequence and device time, how many rows should be stored?

One. The second arrival is a retransmission of the same measurement and must be collapsed by the unique index. Storing both inflates daily counts by the retransmission rate; in the worked example that is about 17 extra rows per day across 12 devices.

Q2. Should a late packet be sorted by device time or arrival time?

By device time, so it lands at its correct position on the timeline. Arrival time stays as a separate audit field. In the worked example a frame stamped 06:35 may arrive at 06:41:12, a 372-second gap that is recorded but not used as the chart axis.

Q3. How many frames does the platform actually ingest per day in the example?

Roughly 3,473 arriving frames: 3,456 unique frames from 12 devices at one frame per 5 minutes, plus about 17 duplicates from a 0.5% retransmission rate. Size the write path for 3,473, not 3,456.

Q4. What happens to a frame older than the backfill window?

It is rejected or written to an exception store, not merged into the main series. With a 6 h window, a frame more than 360 minutes older than its slot is outside the rule. The boundary must be stated explicitly, in device time.

Q5. Two writers claim the same record. Which value survives?

The higher-priority writer wins, by a rule defined in advance. Live frames normally outrank backfill. If priorities tie, keep the earlier arrival. A writer_id field records the decision. Leaving the outcome to database row order makes results non-deterministic after a restart.

Q6. When does the three-field deduplication key stop being unique?

When counters wrap or clocks drift across the window. An 8-bit sequence repeats after 255 frames, a 16-bit counter after 65,535. Add an epoch to the key. A device clock that gains 10 minutes per day can push device time outside a 6 h window.

Summary and next steps. An IoT monitoring platform treats duplicate and late packets as an ingest-governance problem, not a chart problem. Fix the three-field key, sort by device time, audit by arrival time, bound the backfill window in hours, rank the writers and keep quality flags on every row.

Before committing the design, run a short replay. Push the same frame twice and confirm one row. Inject a frame 372 seconds late and confirm its plotted position. Drive two writers at one record and confirm the priority rule. Record the window and overwrite rule in the acceptance document, and recheck them whenever device count, frame interval or link behaviour changes.

Define the key before the dashboard

An IoT monitoring platform must decide what a duplicate is before any chart or alarm is configured. Twelve devices on a 5 minute cadence produce 3,456 frames a day; at a 0.5% retransmission rate about 17 more arrive, and a 6 hour backfill window can hold 864 slots. A three-field key of device ID, sequence and device time collapses retransmissions, while arrival time remains the audit field for the 372 s delay. Set the overwrite rule and quality flags at ingest.

Designing deduplication for a monitoring platform? Leave the device count, frame interval and late window on our contact page, and we will help you size the key and backfill store.

Related recommendations

Sensors & Weather Stations Catalog

Agriculture Sensors and Weather Stations Catalog-NiuBoL.pdf

Weather Stations Catalog-NiuBoL.pdf

Agriculture Sensors Catalog-NiuBoL.pdf

Water Quality Sensor Catalog-NiuBoL.pdf

Related products

Tell us your requirements, Let's discuss more about your project.we can do more.

Name*

Tel*

Email*

Company*

Country*

Message


online
Contacts
Email
Top
XIoT Monitoring Platform: Handle Late and Duplicate Packets-Product knowledge-Automatic Weather Stations_Industrial, Agricultural, Water & Environmental IoT Monitoring Solutions—NiuBoL

Screenshot, WhatsApp to identify the QR code

WhatsApp number:+8615367865107

(Click on WhatsApp to copy and add friends)

Open WhatsApp

The WhatsApp ID has been copied, please open WhatsApp to add consultation details!
WhatsApp