How to measure latency between devices and Azure IoT Hub

In many of my last projects, I wanted to control latency levels among devices and IoT Hub. For many of them, I was just curious and for other, it was a real customer requirement.

How to do it?

What I ended up implementing for a very simple latency control relied on the items below:

  • new message type called “latency” and containing request timestamp
  • new IoT Hub endpoint (Event Hub type) to receive all the routed messages requesting latency control
  • new route based on “latency” message type and sending latency messages to the corresponding endpoint
  • new Azure Function connected to the Event Hub mentioned earlier. This function called an IoT Hub Direct Method. Its payload contained the original request timestamp. That way, the device could math the time spent for the round trip.

 

NOTE: in this case, latency measured device to cloud communication and its corresponding response. Single latency measure (merely device to cloud communication) could be enough in other cases.

If I get some free time in the upcoming days, I will try to package the solution and publish it (at least a kind of PoC).

Hope it helps or gives ideas.

Feel free to complete or comment.

How to measure latency between devices and Azure IoT Hub

Leave a comment