Real-time fleet management with MQTT and Gatling

Shaun Brown
Product Marketing Manager at Gatling
Table of contents

Real-time information is a competitive advantage In our hyperconnected world. Businesses that can respond to events as they happen gain a significant edge over those operating on delayed information. Nowhere is this more apparent than in logistics and shipping, where minutes can separate on-time deliveries from costly delays and penalties. For fleet operators managing hundreds or thousands of vehicles across vast territories, the ability to track assets in real-time isn't just a technological nicety—it's a business imperative that directly impacts customer satisfaction, operational efficiency, and bottom-line results.

The challenge: real-time visibility at scale

Managing a distributed fleet demands continuous, low-latency visibility into where vehicles are, what they are carrying, and whether anything is trending toward failure. Thousands of trucks stream small updates every few seconds: GPS coordinates, temperature, and humidity for cold-chain compliance, and operational signals like fuel levels or maintenance alerts.

Traditional HTTP polling strains networks and budgets at this cadence, and the operational lag it introduces can translate into late deliveries, missed SLAs, and reactive firefighting. What you need is a transport that treats frequent, small messages as a first-class use case and remains dependable over unstable links.

That is exactly where MQTT excels. The protocol’s lightweight framing, pub/sub semantics, and Quality of Service (QoS) controls were designed for constrained networks and intermittent connectivity. MQTT lets you move from chatty, point-to-point polling to event-driven streams that scale with your fleet rather than against it.

MQTT: the perfect fit for fleet management

MQTT (Message Queuing Telemetry Transport) provides a brokered publish/subscribe model that decouples producers and consumers.

Vehicles publish to topics that represent their domain (for example, telemetry or alerts), and back-end services subscribe to the slices of the stream they care about. Because the protocol minimizes overhead and supports delivery guarantees, it is well-suited to cellular links where bandwidth fluctuates and outages happen.

As your fleet grows, you scale subscribers and partitions rather than adding bespoke endpoints and timers.

For operational teams, the impact is tangible: lower network usage, simpler scaling characteristics, and near-instant signal propagation from the edge to dispatchers and customer-facing applications.

The challenge of testing MQTT systems

Building on MQTT solves the transport problem, but it does not answer the scale question by itself.

The challenge is validating behavior when thousands of devices publish concurrently, networks degrade, and back-pressure appears deep in your pipeline. Meaningful load tests must emulate device behavior, network pathologies, and realistic message patterns.

Many generic load tools center on HTTP and cannot express MQTT flows, let alone the nuances of retain flags, session state, or QoS levels under churn.

Without realistic testing, teams are surprised in production by broker saturation, uneven consumer lag, and dashboards that fall seconds behind when it matters most.

Gatling’s new MQTT support for the JS/TS SDK

Gatling now supports MQTT in its JavaScript and TypeScript SDKs, enabling you to author MQTT performance scenarios with the same language and tooling as your services.

You define virtual devices that connect, subscribe, and publish on MQTT topics; you model message rates, payload shapes, reconnections, and QoS; and you observe how your system behaves under progressive and peak load. Because scenarios are code, they are versioned, reviewed, and automated like the rest of your stack.

This addition brings MQTT into Gatling’s proven engine for high-concurrency simulation and rich reporting, so you can expose bottlenecks before they expose you.

Gatling’s MQTT protocol support is available to Community Edition users on a limited basis. To unlock MQTT load testing at scale, discover our Enterprise Edition options

A realistic demo scenario: real-time fleet tracking

To ground this, consider a demo where simulated vehicles publish GPS updates to a broker. A back-end service consumes those messages and streams them to a web dashboard over WebSocket, updating a live map.

With Gatling driving the load, you can scale from hundreds to thousands of vehicles, vary publish intervals, and inject network instability to measure resilience.

A sample message might look like:

{

 "vehicleId": "1234",

 "lat": 40.7128,

 "lng": -74.0060

}

From there, you evaluate broker throughput, consumer lag, and frontend freshness, observing how each component degrades and recovers.

Business impact and ROI

For technically minded buyers, the calculus is straightforward.

  • Reliability improves when you validate QoS behavior and reconnection strategies under realistic pressure conditions like a large number of concurrent clients.
  • Costs decrease when you replace inefficient polling with streamlined publish/subscribe architecture and identify scaling issues before deployment.
  • Lead time decreases as teams leverage a shared, repeatable performance testing framework that integrates with CI pipelines such as GitHub Actions and provides data for effective capacity planning.
  • Customer experience benefits from accurate, real-time tracking you can trust, even during network interruptions or peak usage periods.

MQTT paired with Gatling gives you a predictable path from prototype to production scale.

Get started with Gatling

Real-time fleet management rewards teams that design for failure and test for scale. MQTT provides the right communication model for the edge. According to McKinsey's latest analysis on IoT in logistics, companies that implement real-time fleet management solutions see an average 10-15% reduction in fuel costs and 20% improvement in asset utilization. Yet their research also reveals that fewer than 30% of implementations are properly tested for scale before deployment, resulting in costly service interruptions when demand spikes. As more vehicles come online—Gartner predicts 29 billion connected devices by 2026—the difference between success and failure will increasingly be determined by how thoroughly systems are validated under realistic conditions.

To help you get started with MQTT and JavaScript, we created:

To help you stand up a broker, run the example, and evolve it into your own scenarios. With Gatling’s MQTT support in the JS/TS SDK, you can begin by modeling a handful of devices and quickly ramp to fleet-scale tests as requirements solidify.

FAQ

What is MQTT and why is it good for IoT?

MQTT is a lightweight pub/sub messaging protocol ideal for IoT. It minimizes network overhead, handles unreliable connections, and scales easily—making it perfect for real-time fleet tracking and device telemetry.

How does MQTT work in IoT systems?

MQTT uses a broker to route messages from devices (publishers) to backend apps (subscribers). Devices send data to topics; subscribers receive relevant updates. It's efficient, reliable, and works well over cellular or spotty networks.

What are the scaling challenges with MQTT?

At scale, MQTT systems face broker overload, unstable networks, and consumer lag. Thousands of devices publishing frequently can strain resources without proper testing, leading to message loss or delays in dashboards.

How do you test MQTT systems for scale?

Use tools like Gatling to simulate thousands of devices publishing MQTT messages. Model network drops, message rates, and QoS to test real-world performance and prevent failures before deployment.

Ready to move beyond local tests?

Start building a performance strategy that scales with your business.

Need technical references and tutorials?

Minimal features, for local use only