Delay of Microsoft.Devices.DeviceConnected (4 to 6 minutes)

Erik Gylling 50 Reputation points
2023-09-05T09:22:19.9166667+00:00

Hi

Setup for IotHub

I am working on a system where I use an IotHub (S1 tier) that communicates with one IoT device using the setup showed in the table. Furthermore, I use an EventHub that subscribes on Microsoft.Devices.DeviceConnected and Microsoft.Devices.DeviceDisconnected events and forwards them to the backend.
According to your documentation on device connection state interval it can take up to 1 minute for an connection state event to be raised.

I have observed that the Microsoft.Devices.DeviceConnected event has been delayed up to 6 minutes after a connection have been established between a device and the IotHub. It is important to note that I have not observed a delayed Microsoft.Devices.DeviceDisconnected event.

This is shown on Delay of Connection Events below where 75% of the connect events had a delay above four minutes, and 0% of the disconnect events were delayed.

ConnectionStateDelay

It has also been observed that a connection between IoTHub and DeviceClient is established and after four to six minutes the connection state event is delivered to the EventHub and forwarded to the backend, as shown on Communication from IotHub to EventHub. The graph shows two delayed signals in red squares compared to the first incoming message.

Note that a message should be received by the EventHub within a minute each time a device change connection status. This is the case when the number of connected devices goes from 1 to 0 (a device becomes offline), and is not the case when the number of connected devices goes from 0 to 1 (a device becomes online).

CommunicationFromIotHubToEventHub

Do you have an idea of where this delay has root, and how I can mitigate this problem?

Azure Digital Twins
Azure Digital Twins
An Azure platform that is used to create digital representations of real-world things, places, business processes, and people.
224 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,156 questions
Azure IoT SDK
Azure IoT SDK
An Azure software development kit that facilitates building applications that connect to Azure IoT services.
212 questions
{count} votes