1317  Serialization Scenarios and Bandwidth Analysis

Match Serialization Formats to IoT Use Cases and Calculate Costs

animation
serialization
bandwidth
iot
cost-analysis

1317.1 Learning Objectives

By the end of this section, you will be able to:

  • Match serialization formats to specific IoT deployment scenarios
  • Calculate bandwidth costs for different format choices at scale
  • Design custom message structures and analyze their serialization efficiency
  • Apply format-specific best practices for common IoT use cases

1317.2 Introduction

Different IoT scenarios have vastly different constraints. A battery-powered LoRa sensor has different needs than a factory MQTT gateway. This chapter helps you match the right serialization format to your specific use case and quantify the bandwidth and cost implications.

1317.3 IoT Scenario Analysis

(a)
(b)
(c)
(d)
Figure 1317.1: Serialization format recommendations for common IoT scenarios

1317.4 Bandwidth Impact Calculator

Use this calculator to estimate the real-world cost implications of your serialization format choice across your entire IoT deployment.

(a)
(b)
(c)
(d)
(e)
(f)
Figure 1317.2: Calculate bandwidth savings from serialization format choice

1317.5 Custom Field Editor

Test how your specific message structure affects serialization efficiency across different formats.

(a)
(b)
(c)
Figure 1317.3: Create custom IoT message structures to test serialization

1317.6 Format Deep Dives

TipJSON - Universal but Verbose

Best for: Debugging, configuration files, REST APIs

{"deviceId":"sens-001","temperature":23.5,"timestamp":1704067200}
  • Human-readable text format
  • Self-describing (field names included)
  • Native browser/JavaScript support
  • Largest payload size (baseline)

IoT Consideration: Use when debugging ease outweighs bandwidth concerns, or for device configuration where human editing is needed.

TipMessagePack - Binary JSON

Best for: General IoT messaging, MQTT payloads

MessagePack achieves ~40% size reduction by:

  • Using binary type markers instead of JSON syntax
  • Storing small integers in 1 byte
  • Eliminating quotation marks and colons

IoT Consideration: Drop-in replacement for JSON with significant size savings. Excellent balance of efficiency and flexibility.

TipProtocol Buffers - Maximum Efficiency

Best for: High-throughput systems, typed APIs

Protocol Buffers achieve ~60% size reduction through:

  • Schema-based field numbering (no field names in payload)
  • Variable-length integer encoding (varints)
  • Optional/repeated field optimization
message SensorReading {
  string device_id = 1;
  float temperature = 2;
  int64 timestamp = 3;
}

IoT Consideration: Best choice when you control both sender and receiver, and schema management is acceptable.

TipCBOR - IoT Native

Best for: CoAP-based systems, constrained devices

CBOR was designed specifically for IoT:

  • IETF RFC 8949 standard
  • Native CoAP content type
  • Supports binary data efficiently
  • Designed for constrained environments

IoT Consideration: First choice for CoAP deployments and standards-based IoT implementations.

WarningRaw Binary - Use With Caution

Best for: Extremely constrained devices, fixed-format telemetry

Raw binary provides smallest payloads but:

  • No built-in type safety
  • Schema changes break compatibility
  • Debugging is difficult
  • Endianness must be managed manually

IoT Consideration: Only use when every byte matters (LoRa, satellite) AND message format will never change.

1317.7 Scenario Selection Guide

NoteQuick Decision Guide by Scenario
Scenario Primary Choice Alternative Avoid
LoRa/Sigfox Raw Binary CBOR JSON
NB-IoT CBOR Protobuf JSON
Industrial MQTT MessagePack Protobuf -
REST APIs JSON MessagePack Binary
High-frequency streams Protobuf Binary JSON, Avro
Edge buffering Avro Protobuf JSON
Device config JSON CBOR Binary
CoAP systems CBOR - JSON

1317.8 Summary

NoteKey Takeaways
  1. Match format to constraints - Every scenario has different bandwidth, processing, and battery requirements
  2. Bandwidth costs add up - At scale, a 60% size reduction translates to significant cost savings
  3. Custom messages vary - Test your actual message structure to see real-world size differences
  4. Format features matter - Schema requirements, human readability, and IoT suitability influence the choice
  5. Don’t over-optimize - JSON is fine when debugging ease matters more than bandwidth

1317.9 What’s Next

Continue exploring serialization analysis with: