Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set MQTT connect and receive timeout. #104

Merged
merged 1 commit into from
Sep 10, 2024

Conversation

kvp1703
Copy link
Contributor

@kvp1703 kvp1703 commented Aug 6, 2024

Setting connect and receive timeouts for faster OTA through newly introduced APIs.

Setting connect and receive timeouts for faster OTA through newly introduced APIs.
@kar-rahul-aws
Copy link
Member

Hi @kvp1703
Thanks for raising the PR.
Are we facing any compilation issue or seeing performance drop without this code addition? Just wanted to understand the use case for making this change .

Thanks.

@aggarg
Copy link
Member

aggarg commented Aug 26, 2024

@kvp1703 Would you please respond to the question from @AniruddhaKanhere ?

@avsheth
Copy link

avsheth commented Sep 5, 2024

Hi Aniruddha,
Apologies for the delayed response.

As you pointed out, Agent is designed to work with non-blocking socket, however, earlier, Espressif's transport layer had recv socket in blocking mode with timeout of 1 second. And this timeout was applicable to all network ops, i.e. connect, recv and send.
We added new set of APIs in the recent esp-aws-iot upgrade, to independently set timeouts for each of them, since it was observed that connect, at times, takes longer than a second on slower network, whereas coreMQTT Agent works best with smaller recv timeout.

This change reduced recv wait time from 1 second to 100ms, resulting in better OTA performance. It can be set to 0 as well to have a true non-blocking behaviour. Timeout APIs also allow dynamically changing timeouts based on application's requirement.

Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants