What is Lightweight Protocol?

A lightweight protocol is a communications protocol designed to use relatively little of a device’s or network’s available resources while still providing the functions its application needs. Those resources can include bandwidth, memory, processing time and battery energy. MQTT and CoAP are common examples in connected-device systems, but “lightweight” is a design description, not the name of one universal protocol or a fixed packet-size limit.
The practical question is lightweight in what respect, under which conditions? A compact message can still require a costly connection setup, repeated retries or substantial security state. A useful comparison follows the complete secure exchange and the device’s operating pattern, rather than choosing whichever protocol advertises the smallest header.
What is the protocol trying to save?
A small battery sensor has different constraints from a mains-powered gateway or home server. Its radio may spend most of its time asleep, its memory may hold only a limited number of pending messages, and reconnecting may cost more than sending a small reading. A powerful server can still benefit from efficient messaging when it handles many clients.
Resource | What to examine |
|---|---|
Network bytes | Headers, payload, replies, setup, keep-alives and retransmissions. |
Memory | Buffers, connection state, subscriptions, outstanding work and security contexts. |
Processing | Parsing, encoding, cryptography, copying and application handling. |
Energy | Radio wake time, listening, transmission, reconnection and processing. |
Operational complexity | Configuration, interoperability, diagnostics, updates and recovery. |
The IETF’s constrained-node terminology, RFC 7228, distinguishes device constraints from network constraints. Published in May 2014 as an Informational RFC, it provides useful vocabulary for limited memory, processing, energy and connectivity. Its historical device classes are not a current purchasing specification or a universal minimum for running a particular protocol.
Saving one resource can spend another. A compressed representation can reduce transmitted bytes while requiring more processing and state. A gateway can simplify a sensor’s software while adding another powered component that must be secured and maintained. “Lightweight” needs a named constraint and a measured outcome.
Separate the application protocol from the rest of the stack
An application protocol defines the conversation between software components. Transport and network protocols carry it; security and the link layer add their own work. Comparing only one layer can make a tiny-message design look much cheaper than the complete exchange.
Part of the exchange | Examples of additional cost |
|---|---|
Application framing | Topic or resource name, message type, identifiers and properties. |
Payload | The reading, command or document and its chosen encoding. |
Transport and IP | TCP or UDP headers, addresses, acknowledgements and connection behaviour. |
Security | Authentication, protected records, key establishment and credential handling. |
Link and access network | Ethernet or WiFi framing, airtime, retries, tunnels and other encapsulation. |
The same application message can therefore have different costs over IPv4 and IPv6, a reused connection and a fresh connection, or a local wired link and a lossy radio. Some layers can combine or compress information, so adding headline minimums is an explanatory model, not a substitute for capturing the actual deployment.
The infographic highlights that wider view. Its small-message illustration represents compact application communication; the transport, security and return-path illustrations show why the complete workflow must still be counted.

MQTT and CoAP solve different communication problems
The MQTT protocol uses publish/subscribe messaging. Clients publish on topics and subscribe through a server. That suits a sensor feeding several interested applications without managing a separate direct conversation with each one.
The MQTT broker provides that routing role. It also carries resource and availability responsibilities. A small client does not make the broker, its persistence or the paths to subscribers disappear. Include onward deliveries when calculating a complete system’s traffic.
CoAP is a resource-oriented web transfer protocol for constrained environments. A client can request or change a resource, using concepts such as a URI and response code. The base CoAP specification, RFC 7252, published on the Standards Track in June 2014, defines a UDP binding with optional message reliability and a compact binary format.
Consideration | MQTT | CoAP |
|---|---|---|
Basic interaction | Topic-based publication through a server. | Requests and responses concerning resources. |
Typical transport context | Commonly an established TCP connection, with suitable protection. | Base RFC 7252 uses UDP; other bindings also exist. |
Reliability choices | MQTT QoS and session behaviour alongside the transport. | Confirmable or non-confirmable messages in the UDP binding. |
Deployment question | Where is the broker and which clients need each publication? | Which endpoint exposes the resource, and how is it reached? |
These are starting points, not a complete feature matrix. CoAP extensions include observing resources, and RFC 8323 defines CoAP over TCP, TLS and WebSockets. “CoAP always uses UDP” is therefore too broad. Equally, UDP does not automatically make a complete reliable application smaller: loss handling, timing, security and duplicate processing still need a design.
HTTP can remain appropriate where the device can support it and web integration matters. Compare actual versions and implementations. HTTP/2, specified in RFC 9113, supports multiplexed exchanges and field compression over a connection. An HTTP test that reconnects for every reading is not a fair baseline for every HTTP deployment.
A small header is not the whole packet
MQTT is often described using its minimum two-byte fixed header. That is not the size of every MQTT message. A publication also carries its topic information and payload, with additional fields according to version and options. The Remaining Length encoding can itself grow when the rest of the packet grows.
CoAP’s base UDP message format starts with a four-byte header, followed as applicable by a token, options and payload. That is not a four-byte sensor exchange. Transport, IP, security and replies remain outside that base-header figure. CoAP extensions can also change which fields and lengths are available.
For an exact MQTT example, use the OASIS MQTT 3.1.1 standard, approved on 29 October 2014. The calculation below intentionally fixes the version and packet type. It does not describe all MQTT 5 publications, which have a different properties structure and additional available features.
Techie Broadband calculation: account for one publication
Assume an established MQTT 3.1.1 connection and a QoS 0 PUBLISH containing a 20-byte application payload. The topic is home/temp1, exactly ten UTF-8 bytes because all its characters are ASCII. The packet is small enough for a one-byte Remaining Length field. There is no MQTT Packet Identifier at QoS 0.
MQTT component | Bytes |
|---|---|
Fixed header, including one-byte Remaining Length | 2 |
Topic-name length field | 2 |
Topic name: home/temp1 | 10 |
Application payload | 20 |
Complete MQTT PUBLISH | 2 + 2 + 10 + 20 = 34 |
For a deliberately simplified IP-layer model, put that MQTT packet in one TCP segment. Use a minimum 20-byte TCP header and a minimum 20-byte IPv4 header, with no options. The counted IPv4 packet is 34 + 20 + 20 = 74 bytes. Using a 40-byte IPv6 base header instead gives 34 + 20 + 40 = 94 bytes, before extension headers or other additions.
These are explanatory byte counts, not recommended unencrypted configurations or measured traffic. They exclude TLS, connection establishment, TCP-only acknowledgement packets, retransmissions, keep-alives, link-layer framing, tunnels and subscriber deliveries. TCP can also combine application writes or split them differently, so the one-packet mapping is an explicit assumption.
At QoS 1, this MQTT 3.1.1 PUBLISH adds a two-byte Packet Identifier, making 36 MQTT bytes. Its PUBACK is four MQTT bytes. If each is carried in its own minimum-header IPv4/TCP packet, the two counted packets total (36 + 40) + (4 + 40) = 120 bytes. This still excludes any additional TCP-only acknowledgements and every other exclusion above.
The difference between 74 and 120 bytes is not evidence that QoS 1 is a poor choice. It buys a different MQTT delivery behaviour. Choose the required semantics first, then account for their cost. A smaller count achieved by omitting necessary evidence or reliability is not an equivalent result.
Scale the workload without changing the counting boundary
Suppose 100 devices each produce one such publication every ten seconds. That is 100 ÷ 10 = 10 publications per second. Under the same simplified assumptions, the QoS 0 counted IP traffic is 10 × 74 × 8 = 5,920 bit/s, or 5.92 kbit/s, towards the broker. The QoS 1 two-packet total is 10 × 120 × 8 = 9,600 bit/s, or 9.6 kbit/s across both directions combined.
Those totals are not full WAN usage and do not share the same direction: QoS 0 counts the outbound publication packet, while the QoS 1 figure includes its returning PUBACK. Record upstream and downstream separately when comparing with broadband capacity. Security, setup and real packetisation can materially change both figures.
If the application can represent the same required information in four payload bytes instead of twenty, the QoS 0 MQTT packet becomes 18 bytes and the modelled IPv4 packet becomes 58 bytes. The payload has shrunk by 80%, but the counted IP packet has shrunk by only 16 ÷ 74, approximately 21.6%. Fixed costs remain.
That is an illustrative encoding scenario, not a claim that every JSON record can be replaced by a four-byte number. Preserve identity, units, timestamps, range and versioning wherever the application needs them. A compact payload that loses essential meaning can create a more expensive diagnostic problem later.
Connection reuse and sleeping change the result
A long-lived connection spreads its establishment cost across many messages. A device that connects once, reports frequently and stays reachable has a different workload from a battery device that wakes once an hour. Include name resolution, connection setup, authentication and security negotiation in the latter case, with any supported resumption accounted for.
Keeping a connection usable can require traffic and radio wake time. MQTT Keep Alive provides a connection-checking mechanism when ordinary control traffic is absent; it is not a guarantee that a sensor is producing fresh useful observations. Sending heartbeats too frequently can outweigh savings made inside a small payload.
Sleep also affects control. A receiver that is powered down cannot react immediately to a new instruction unless the design provides a wake mechanism. A gateway or queue may preserve appropriate work for later, subject to expiry and storage policy. Decide the permitted delay before trying to minimise the device’s time awake.
Memory use is not determined by packet length alone. Pending acknowledgements, retransmission buffers, subscriptions, maximum accepted messages and cryptographic state can matter. Measure peak memory during reconnects and errors as well as during a quiet steady-state test. Two implementations of the same protocol can have different resource demands.
Reliability is work, wherever you put it
TCP provides an ordered byte stream with its own loss recovery; MQTT adds application-protocol delivery state above it. Base CoAP over UDP provides its own optional confirmable-message exchange. Neither arrangement makes unreliable connectivity disappear. Moving work between layers changes who stores state, detects loss and retries.
In CoAP, an empty acknowledgement can confirm receipt while the application sends a separate response later. In MQTT, a protocol acknowledgement has the meaning of its delivery exchange. Neither should automatically be presented as proof that a physical action completed. Define application outcomes and handle repeated requests safely.
A low-loss laboratory result may reverse under interference, a long outage or an overloaded receiver. Repeated radio transmissions, security handshakes and reconnect storms can dominate a nominal header saving. Compare a complete successful outcome and report failures as well, rather than averaging only the messages that happened to arrive.
Payloads, batching and fragmentation create trade-offs
Telemetry often contains small, repeated observations. An agreed compact schema can avoid repeating long field names. Text formats can be easier to inspect and integrate; binary formats can save bytes. Actual benefit depends on the values, structure, library and decoding requirements, not just the format’s reputation.
Batching several readings can share headers and setup, but it delays the earliest readings and increases the amount affected by a lost batch. Preserve observation times and define maximum batch size and waiting time. A monitoring task that needs a fresh alarm cannot be evaluated only by bytes per uploaded record.
Large batches can cross size limits or increase packet fragmentation. Distinguish IP fragmentation, TCP segmentation, radio-link fragmentation and application block-wise transfers. They solve different problems and have different recovery costs. Do not assume that one large application message travels as one network packet.
Lightweight must still include security and lifecycle
Authentication, authorisation, confidentiality and update support remain requirements even when the endpoint has little memory. Choose a supported security profile and measure it. Removing encryption from one candidate and retaining it in another produces an unequal comparison, not a useful protocol efficiency result.
MQTT deployments commonly protect transport with TLS. CoAP has security approaches including DTLS and the application-layer protection defined by OSCORE in RFC 8613. Their trust boundaries differ, especially when intermediaries are involved. A small unsecured packet is not a substitute for verifying identities and controlling who may read or change a resource.
Provisioning keys, rotating credentials, renewing trust material and updating firmware also consume resources. Check whether the constrained device can complete those tasks in its real operating conditions. A design that communicates efficiently today but cannot be maintained securely has left out part of the workload.
What does this change on UK broadband?
For a few low-rate sensors on FTTP, available WAN capacity may not be the limiting resource. Device memory, WiFi airtime, battery use, cloud availability or configuration can matter more. A more compact application header will not repair poor signal, an expired certificate, blocked UDP or a failed broker.
A local gateway can collect from constrained devices and use a different protocol towards a remote service. That can keep low-power radio details off the WAN and centralise some processing, but it introduces another dependency. Include gateway power, buffering, permissions and recovery when comparing the complete design.
Faster broadband can help a genuinely congested uplink, while efficient device communication can reduce demand. Neither label establishes low latency or useful delivery by itself. Locate the actual bottleneck and preserve the required reliability, security and response time before choosing an optimisation.
Compare protocols with a repeatable test
Define the useful outcome, payload meaning, delivery requirement and maximum acceptable delay.
Fix the protocol version, security profile, transport, endpoint hardware and implementation settings.
Measure both directions at the same counting layer, including a documented connection and reporting pattern.
Record peak memory, processing and energy or radio activity where those are the limiting resources.
Repeat under representative loss, sleep, reconnect, burst and receiver-failure conditions.
Compare total cost per required outcome, including unsuccessful attempts and recovery work.
Use packet captures and endpoint instrumentation with an explicit scope. Network offload can make a host capture differ from packets seen on the link. Encryption can hide application boundaries, and a byte capture cannot directly establish battery life. Use appropriate independent timing, memory and power measurements when making those claims.
Observed problem | Check before replacing the protocol |
|---|---|
Traffic exceeds the estimate | Counting layer, TLS, setup, keep-alives, retries and onward deliveries. |
Memory spikes during outages | Pending work, retransmission limits, large buffers and reconnect state. |
Battery life is poor | Wake frequency, listening time, signal quality, association and security setup. |
Small messages arrive slowly | Batch timers, queues, sleep policy, connection setup and application processing. |
UDP works locally but not remotely | The supported endpoint path, firewall policy, NAT state and any required gateway. |
Messages arrive but useful work fails | Permissions, payload meaning, freshness, duplicate handling and result evidence. |
Lightweight protocol questions answered
Is lightweight protocol a specific protocol?
No. It describes a design intended to use relatively few resources for its purpose. Name the actual protocol, version, transport and security profile before comparing capabilities or overhead.
What are examples of lightweight protocols?
MQTT and CoAP are common examples in connected-device systems. MQTT uses topic-based publish/subscribe through a server; CoAP provides resource-oriented exchanges. The most suitable choice depends on the application and endpoint constraints.
Does lightweight mean a smaller packet?
Sometimes, but it can also refer to memory, code size, processing or energy use. A smaller application header does not automatically reduce the cost of connection setup, security, retries or radio wake time.
Is an MQTT message only two bytes?
No. Some MQTT control packets are that small, but a publication also needs fields such as topic information and its payload. Version, packet type, QoS and properties affect the full size.
Does CoAP always use UDP?
No. RFC 7252 defines the base UDP binding, while RFC 8323 specifies CoAP over TCP, TLS and WebSockets. Check the binding and implementation actually in use.
Are lightweight protocols less secure?
Not inherently. Security depends on the supported mechanisms, configuration, identities and key management. Compare complete protected deployments rather than treating the absence of security overhead as an advantage.
Will a lightweight protocol make broadband faster?
It can reduce a workload’s resource demand, but it does not change the broadband line’s capacity. Benefits depend on the real bottleneck, reporting pattern and required delivery behaviour.
Key takeaway
A lightweight protocol is useful when it saves the resource that is actually scarce while preserving the outcome you need. Count the complete secure exchange, include state and recovery, and compare equivalent work. A headline header size is only the beginning of that investigation.
The broadband terminology guide explains the transport, performance and device concepts behind that comparison.

