Skip to content

MQTT QoS 2 Messages Slow Down System

DodaTech Updated 2026-06-26 1 min read

In this tutorial, you'll learn about MQTT QoS 2 Messages Slow Down System. We cover key concepts, practical examples, and best practices.

The Problem

Using QoS 2 for all messages causes significant latency and throughput reduction.

Quick Fix

Wrong

// Using QoS 2 for all messages — unnecessary overhead
High latency and throughput bottleneck (4-packet handshake per message).
// QoS 2 for critical commands only
function sendCriticalCommand(command) {
  client.publish('actuators/valve', command, {
    qos: 2,  // Exactly once — for critical operations
    properties: {
      messageExpiryInterval: 30  // Expire in 30 seconds
    }
  })
}

// QoS 1 for important telemetry
function sendTelemetry(data) {
  client.publish('sensors/status', data, { qos: 1 })
}

// QoS 0 for high-frequency data
function sendRawData(data) {
  client.publish('sensors/raw', data, { qos: 0 })
}
Critical commands delivered exactly once. High throughput for telemetry at QoS 0/1.

Prevention

QoS 2 has a 4-packet handshake (PUBLISH → PUBREC → PUBREL → PUBCOMP). Use only when exactly-once delivery is critical (financial transactions, valve control). For most IoT applications, QoS 1 is sufficient. QoS 2 messages consume more broker memory (pending PUBREL state).

DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.

FAQ

### What is the QoS 2 flow?

Publisher sends → broker saves and PUBREC → publisher deletes local copy → publisher sends PUBREL → broker delivers and PUBCOMP → done.

When must I use QoS 2?

Non-idempotent operations: money transfer, one-shot actuator commands, authorization grants. Where duplicates cause incorrect behavior.

Does QoS 2 affect throughput?

Yes. Expect 50-70% lower throughput than QoS 1. The 4-step handshake adds latency and processing overhead on both sides.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro