Advanced Serialization Analysis
Weighted decision matrices, compression, network simulation, schema evolution, and MCU memory fit
Advanced Serialization Analysis
Compare message formats as an engineering decision, not a byte-count contest. Change priorities, link limits, compression, schema churn, and MCU RAM, then watch the weighted winner move through the pipeline.
Weights explain decisions
The same byte model feeds size, CPU, RAM, debugging, evolution, and ecosystem scores.
Compression has a threshold
Large repeated records can shrink. Tiny encrypted uplinks often grow after compression overhead.
Network cost is contextual
A 40-byte saving is minor on Wi-Fi but important on low-rate LPWAN or satellite links.
Schema risk is operational
Field additions, tag reuse, byte order, and old firmware decide whether compact data remains safe.
Model
Fields, samples, labels, and versions define message shape.
Encode
Text keys, binary tags, schemas, or fixed offsets carry values.
Compress
Compression trades repeated bytes for CPU and buffer cost.
Transmit
Payload plus framing turns into airtime and fleet traffic.
Decode
The receiver needs RAM, library support, and validation.
Evolve
Old and new firmware must interpret fields safely.
Model the message
The report starts with field count, repeated samples, label length, and a schema-change expectation.
The payload body is sent as encoded bytes before framing and security overhead are added.
Fleet traffic uses decimal networking units and includes message framing bytes.
Estimated decoder scratch and library RAM stay below the configured device limit.
The selected format can tolerate additive field changes when versioning rules are followed.
Technical accuracy notes
Formulas and units
body_bytes = serialization_model(format, fields, samples, key_chars)
compressed_body_bytes = compression_model(body_bytes, format, compression_mode)
wire_bytes = compressed_body_bytes + framing_bytes
airtime_ms = wire_bytes x 8 / link_kbps
daily_fleet_MB = wire_bytes x devices x reports_per_device_per_day / 1,000,000
decoder_ram_KB = library_ram_KB + scratch_buffer_KB + compression_workspace_KB
weighted_score = sum(dimension_score x weight) / sum(weights)
schema_risk = function(format_rules, schema_changes_per_year, old_firmware_active)
Networking units are decimal MB. Link rate is kilobits per second, so bytes x 8 / kbps gives milliseconds. The score is comparative, not a formal benchmark.
Schema evolution checklist
- For Protocol Buffers, add fields with new numbers, keep old numbers reserved, and avoid changing the meaning or type of a deployed tag.
- For Avro, keep reader and writer schemas available, define defaults for added fields, and test backward and forward compatibility.
- For CBOR and MessagePack with numeric keys, publish a key registry and avoid silently reusing numbers.
- For JSON, tolerate unknown fields and preserve clear names, but remember that name changes still break clients that expect old keys.
- For raw binary, include version, length, endian, scaling, and optional-field rules before deployment.
Format guide
Practice prompts
- Set the scenario to Gateway batch and switch between no compression and gzip-style compression. Which formats benefit most?
- Set MCU RAM to 16 KB and compare Avro, JSON, Protocol Buffers, and raw binary. Which constraint becomes visible first?
- Raise schema changes per year and keep old firmware active. Which formats remain high scoring, and why?
- Set link rate below 1 kbps and increase framing bytes. Which formats become impractical for small payload limits?