aedes-stats reports 2 different topics on a k8s cluster
massimo1980 opened this issue · 1 comments
Hi there,
my group has developed a MQTT server over a Kubernetes cluster. The actual service is reachable through a LoadBalancer that manage 2 pods of the same instance.
The service seems to work pretty well in performance's terms, but there are some strange numbers that we can't understand:
Using MQTT Explorer, we found 2 different sub-topics ID related to aedes-stats:
in the first one, seems to be reported the correct number of connected devices and "maximum" clients connected
the second one, instead, report a a slightly different number of connected clients, but the "maximum"clients seems to report something like "x2" of the first ID report
Is it possible that aedes-stats of the second sub-topic ( that presumably is the second pod of our cluster ) is reporting the "sum" of both "stats" ?
Tnx
Is it possible that aedes-stats of the second sub-topic ( that presumably is the second pod of our cluster ) is reporting the "sum" of both "stats" ?
Yes, with a quick look at source code you will see: https://github.com/moscajs/aedes-stats/blob/main/stats.js#L33
When two instances are up the first to run will get the correct number of clients and the second could miss some of them
PR?