Azure / azure-iot-sdk-c

A C99 SDK for connecting devices to Microsoft Azure IoT services
https://azure.github.io/azure-iot-sdk-c
Other
587 stars 739 forks source link

Effective data usage #547

Closed narendranaren14 closed 5 years ago

narendranaren14 commented 6 years ago

Hi,

This is more of clarification. Recently, I am working on comparing the effective data usage of MQTTvsAMQPvsHTTP.

I ran websocket sample code of mqtt and amqp and telemetry to measure effective data usage. In the background, I watching the data traffic using vnstat. In order to upload 1001bytes of data, effective data usage is 18KiB, 19KiB and 27KiB for HTTP, MQTT and AMQP respectively. Therefore the overhead is 1743.2%, 1845.6% and 2664.8% for HTTP, MQTT and AMQP respectively. This is way to high for IoT applications which is running on narrow-band technology CAT-M.

Did Microsoft or anyone see similar behavior? if so, is there a provision for optimization in the code?

Regards Narendra NA

AndWass commented 6 years ago

Fyi this is related to #289 but yes I have also seen a high overhead of AMQP messages. I haven't done any measurements such as these but my feeling has been that the protocol overhead is not neglible.

narendranaren14 commented 6 years ago

Hi @Shakti213 ,

Appreciate the response! #289 does not provide much information other than SDK is optimized for minimal overhead. This means there is limited/no provision for further optimization.

MQTT takes around 27 packets to upload 1001bytes of data. I might sound naive here; just wondering if anyone played around optimizing packet size so as to reduce number of packets. If so, please share your observation.

Regards Narendra NA

ewertons commented 6 years ago

Hi @narendranaren14 , thanks for your question.

Could you give more details about your experiment please? What is the version of the SDK you used? Did you use the samples available on the repo? Are you tweaking any settings on the SDK?

Did you measure the total bytes on the wire from when the application started (includes connection establishment and authentication) all the way to the moment you send one telemetry message? Or you intentionally measured the data usage for one cycle of Telemetry (sending one message to the cloud)?

The reason for the questions is to gather more info since we have an effort running in parallel to understand the data usage better and optimize it.

narendranaren14 commented 6 years ago

Hi @ewertons ,

I measured total bytes on the wire from the beginning of the application to telemetry message. My next step is to measure bytes for only one telemetry if it is possible. Also, I want measure the total bytes for unsecured communication. Hopefully, next week I should have some values to share.

Regards Narendra NA

jspaith commented 6 years ago

Collecting and publishing this type of data is very much on our team's radar (though I don't have an eta at present we very much want this too). I'm moving from question=>area-documentation to more accurately reflect its status.

I-Connect commented 6 years ago

Hi,

Any update/news on this?

I have the same issue, for sending a very simple 50 bytes json message via POST to a HTTP endpoint using GPRS I see a data usage of around 15KB on the SIM card.

I suspect SSL is also a main contributer to the overhead...?

Regards, Jeroen

InfiniteYuan commented 5 years ago

@I-Connect Hi, you can share your source code for GPRS to connect to Azure. Thank you in advanced.

massand commented 5 years ago

@narendranaren14 - we are planning on publishing some analysis on our LTS branches in the near future, as part of documentation improvements. Stay tuned!

If there is specific concerns with code that bloats bandwidth consumption, please file a bug with repro steps. Thanks!

az-iot-builder-01 commented 5 years ago

@AndWass, @narendranaren14, @ewertons, @jspaith, @I-Connect, @InfiniteYuan1, @massand, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey