Best way to calculate average message size

63 views
Skip to first unread message

Gildas Léauté

unread,
Sep 25, 2023, 9:47:18 AM9/25/23
to vernemq-users
Hi team,

I have a VerneMQ cluster deployed (3 nodes) , with various clients sending various publishes messages of various size. I am trying to come up with the best method to calculate the average size of a publish message.

So far, I haven't found a dedicated metric for this. Therefore here is my current method :

- get the average number of publish / per second :
sum(irate(mqtt_publish_received{mqtt_version="4"}[10s]))
322req/sec


- get the average bytes received (or should I use cluster_bytes_received ?) :
sum(irate(bytes_received[10s]))
310942 bytes/sec

And simply divide : around 1Kbyte / req

Anyone having the same need and maybe found something more precise ?

Regards

 



André Fatton

unread,
Sep 25, 2023, 11:07:01 AM9/25/23
to vernemq-users
Hi Gildas,

I think what you do makes sense and is the closest you can get to average the incoming message payload size.
bytes_received will come from the MQTT sessions (TCP and Websocket). cluster_bytes_received will measure bytes received coming for inter-node message forwarding. You should not use that for measuring, as you will already have your data point in bytes_received for every incoming message.

Hope this helps :)
Best,
André
Reply all
Reply to author
Forward
0 new messages