FlashMQ is a multi-threaded fast lightweight MQTT broker. It’s written in C++, using mostly POSIX (Linux) APIs, as an event-driven multi-core state machine. This means it aims to scale linearly with the amount of cores in a system, and likewise incur load linear to the amount of clients/messages. Currently, it’s capable of reaching one million messages per second at 1.3 gbit/sec on a single four core server (and play full motion ASCII video at the same time 😉 ), and handle more than four million connections on one server.

Design goals/aspects

  • Simple yet powerful (fast and scales well).
  • One thread per CPU/core, with clients living in one thread only.
  • Event and readiness-change driven.
  • Very few dependencies, for ease of deployment and code stability.
  • Stable code base. MQTT is simple enough that you don’t need esoteric features or libraries, so using C++ and few external dependencies, it should be able to compile 20 years from now, and work consistently across OS versions.

Current Features

  • MQTT 3.1, 3.1.1 and 5.0
  • Retained messages
  • Wills
  • Native HTTP1 websocket support, without external libraries. HTTP2 will not be implemented. There’s no advantage and it’s overly complex. You can always proxy with Nginx if you really want it.
  • SSL.
  • QoS 0, 1 and 2.
  • Authentication with plugin or ‘mosquitto_password_file’.
  • Native C++ FlashMQ authentication plugin interface.
  • Mosquitto auth plugin version 2 compatibility. This comes with a caveat though: it must be thread safe. Config options exist to perform some serialization, but it’s not a guarantee.
  • Intel SSE4.2 (SIMD) instructions for string/topic handling.
  • Persistent state (save sessions, subscriptions and retained messages).

Roadmap for the 1.0.0 release

  • Formalization of the persistence file format and plugin interface. Before the 1.0.0 release, they may contain breaking changes. The current version from git master contained the required changes for MQTT5 and will likely be it.