Comments (9)
Hi @bartoszbr
There are 2 topics here. The first one is the retry/reconnect logic, the second is the ping delays between service and device.
Let me first answer to the keep alive delays:
All Azure services are bound to the Azure load balancer TCP Idle time out which is 4 min (as of today), which means that the Azure load balancer will tear down any TCP connection to any service if no traffic has happened in the last 4 minutes. In order to ensure a Device/IoT Hub service connection stays alive (not that this applies only for MQTT or AMQP protocols, not for HTTP) both the service and the device client regularly send a "keep alive" or ping message: the service will ping the device before the 4 minutes timeout. The device client (our SDK) will send a keep alive (empty frame) every 2 minutes.
Few notes on the keep alive delays::
- The keep alive mechanism is implemented only on the device client side of things, not on the service client side..
- There are changes arriving soon to the Azure load balancer idle timeout that will impact these timings (will increase them). Stay tuned as we will make changes to the clients as soon as possible to minimize traffic still maintaining the connection alive between client and service.
Regarding the retry/reconnect logic:
We are in the process of implementing retry /reconnect policies across all our device SDKs. Once this implementation is done across all SDKs we will document them. The principle is to offer a set of configurable retry policies that the user can choose from depending on the best logic for his scenario.
It seems you have done tests on the service client side of things. In the service client, the feedback receiver mechanism will keep on retrying to establish the connection to the service until a Fatal exception occurs. You can see the implementation here: https://github.com/Azure/azure-iot-sdk-csharp/blob/master/service/Microsoft.Azure.Devices/AmqpFeedbackReceiver.cs
from azure-iot-sdk-csharp.
Hello,
I have issue with devicelostlockexception. I need to understand when this exception will be raised and also whether the connection will reestablish by itself and about the data send during that time will be rejected or will the abandoned message will be re-en-queued. My scenario is like sending 200k tags @ 10s collection rate 20k per second. So during this run we get devicelostlockexception. My concern is whenever this error raises whether the failed message is being re-enqueued or not.
from azure-iot-sdk-csharp.
Hi @olivierbloch,
Do you have an idea when we can expect the changes to the Azure load balancer TCP idle timeout to be made available ? Also, can we expect to be able to configure the timeout for the IoT Hub public IP addresses up to 30 minutes just like in the Basic Azure Load Balancer (https://docs.microsoft.com/en-us/azure/load-balancer/load-balancer-tcp-idle-timeout) ?
from azure-iot-sdk-csharp.
Hi @bloodwine
Azure IoT Hub service has already been updated to use load balancer with timeout as 30 minutes.
For MQTT, the max on service side in 10 minutes currently. So you can set something like in C# application to set client side timeout to 6 minutes. MQTT server will set 6 x 1.5 = 9 minutes on server side
var connectionString = DeviceConnectionString;
var settings = new ITransportSettings[]
{
new MqttTransportSettings(TransportType.Mqtt_Tcp_Only)
{
KeepAliveInSeconds = 360,
}
};
For AMQP, max on service side is 25 minutes but you will have to open ticket with Azure support to increase the limit on your HUB. Please note that there is also a client side SDK change needed configure the service side ping for AMQP as shown in example below to reduce the service side pings.
This option is currently only available in C SDK. For other SDK's, it is work in progress.
from azure-iot-sdk-csharp.
Similar to Azure/azure-iot-sdk-java#10
from azure-iot-sdk-csharp.
Hi @olivierbloch,
You mentioned above that
The device client (our SDK) will send a keep alive (empty frame) every 2 minutes.
We are using the "LL" API of the C SDK with AMQP on a Windows 10 device, and find that after several minutes of inactivity, the connection to the Hub is dropped (with a socket failure error 10054). When using the LL API, does our app itself need to periodically ping the Hub to keep the connection alive?
from azure-iot-sdk-csharp.
@jspaith @jebrando Can you clarify the question above?
from azure-iot-sdk-csharp.
Hi @rgacuity
can you please post this issue on the C SDK repo so that we can keep track of it in the right place?
Thanks
from azure-iot-sdk-csharp.
OK, have done so at Azure/azure-iot-sdk-c#499
from azure-iot-sdk-csharp.
Related Issues (20)
- AOT-compatible Microsoft.Azure.Devices.Client HOT 1
- SDK version :2.0.0-preview007 CreateAsync() Json Error
- [Bug Report] WebSockets not working on Web Assembly HOT 1
- Latest device client does not connect over MQTT HOT 9
- Errors while running e2e tests with .NET 8.0 HOT 1
- How to use tpm private key for TLS with IoT Hub SDK (Not TPM Attestation) - for DeviceAuthenticationWithX509Certificate HOT 4
- [Bug Report] AMQP DeviceClient is slow to respond to device being disabled
- Desired Properties callback not triggering after a reconnect HOT 5
- [feature request] Move to System.Text.Json to support AOT HOT 2
- [Bug Report] DeviceClient.SendEventAsync takes over one minute after update from 1.42.0 to 1.42.2 HOT 7
- [BUG] error CS0426: The type name 'Create' does not exist in the type 'ServiceClient' HOT 1
- Building digital twin of the robotic arm [Technical Question] HOT 2
- How do I send data stored in array (floating type) from my robot to IoT hub? [Technical Question]
- [Bug Report] Fails to establish TPM connection HOT 1
- [Technical Question] Security: Check root certificate on device-to-cloud connection HOT 10
- Unhandled exception. Microsoft.Azure.Devices.Client.Exceptions.IotHubException: Request 817bda7c-6fc4-40e0-8946-93eb851fcb12 returned status 403 [Bug Report] HOT 7
- [Bug Report] Send message in batch to multiple outputs using ModuleClient throws HOT 2
- Is it possible to send bulk messages in telemetry from device to IoT hub? [Technical Question]
- [Technical Question] HttpClientHelper error code 400030 HOT 3
- [Bug Report] When try to fetch reported properties after updating the reported property it will return previous version of reported property not the latest one. HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from azure-iot-sdk-csharp.