As a MQTT broker admin, you may often want to know which clients are the slowest. We have a nice ‘top’ view for you. One option is perhaps to instrument the subscriber code with latency measurements. However given in MQTT world, the subscribers might be devices out in the wild which are hard to upgrade or collect metrics from.
EMQX v4.4 has a nice feature to overcome this challenge.
The per clientid-topic latency measurements are ranked in the table view as below.
A new module named
emqx_mod_slow_subs was added in this release. With this module enabled, EMQX will start measuring message transmission latency. The measurement always starts at when a message is received by EMQX, the end of the measurement is configurable. Find more details in EMQX doc Slow subscribers statistics
How to enable it
It can be enabled from the dashboard UI, in the “modules” tab.
How to configure it
Find the configs in
emqx.conf config namespace is
For EMQX Enterprise edition, it can be dynamically configured from the dashboard UI.
Does it affect system performance
Very little with the default configuration.
- First of all, the module can be switched off, when switched off, it costs nothing.
- EMQX only collects latency for statistics when over certain limit (
- EMQX does not rank ALL subscribers, but the slowest top-K during the latest sliding time window.
module.slow_subs.top_k_numconfig value (default to
10), as long as it is not tens of thousands, the resources spent on continuous ranking adjustment is insignificant.