Azure IoT Edge - Device To Cloud message size error

Garapati, Sri Kishan 0 Reputation points
2025-01-13T20:29:01.3+00:00

I have an exception when an IoT edge module sends a message to the IoT Hub - MessageTooLargeError: Message size is greater than 256KiB.

Question:

  1. Will a higher tier allow for a larger size?
  2. Would not an edge module break it down to smaller chunks before sending up? or
  3. Is there a solution / recommendation to break down a message which IoT Hub can put back on the cloud side?
  4. I saw another article which said that if we send a large message, the daily limits will be considered based on 4KB chunks. Does that mean a 256KB message will be considered as 65 thousand message rather than a single message when accounted against the daily limits of the tier?

Kishan

Azure IoT
Azure IoT
A category of Azure services for internet of things devices.
410 questions
Azure IoT Edge
Azure IoT Edge
An Azure service that is used to deploy cloud workloads to run on internet of things (IoT) edge devices via standard containers.
584 questions
Azure IoT Hub
Azure IoT Hub
An Azure service that enables bidirectional communication between internet of things (IoT) devices and applications.
1,225 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Walter Coan 150 Reputation points MVP
    2025-01-13T22:39:57.34+00:00

    Hi Kishan,

    Thank you for your questions, let me try to help:

    1. The larger size of the message for IoT Hub is 4KB as you can see in this link: https://zcusa.951200.xyz/en-us/azure/iot-hub/iot-hub-devguide-quotas-throttling?wt.mc_id=AZ-MVP-5003638
    2. As you write the code for send the message, you have the responsibility to break the message size to feet the IoT Hub limits
    3. One solution is use the Azure Blob Storage on IoT Edge, to store the larger messages, and then just send the object key in the IoT Hub message. This link has more information https://zcusa.951200.xyz/en-us/azure/iot-edge/how-to-store-data-blob?wt.mc_id=AZ-MVP-5003638&view=iotedge-1.5
    4. Probably you are talking about this article (https://zcusa.951200.xyz/en-us/azure/iot-hub/iot-hub-devguide-quotas-throttling?wt.mc_id=AZ-MVP-5003638#throttling-details) and the limit for each unit is 160kb per second per unit.

    I hope this could help.

    Walter

    0 comments No comments

  2. Sander van de Velde | MVP 34,201 Reputation points MVP
    2025-01-14T12:55:34.9766667+00:00

    Hello Kishan,

    welcome to this moderated Azure community forum.

    The maximum size of one message is 256KB.

    The term 'message' could be confusing because Microsoft mentions counting messages per day for the maximum throughput.

    The maximum throughput is counted in chunks of 4KB (of 0.5 KB for the free tier) so a 256KB message is essentially 64 chunks.

    A 6KB message is counted as 2 chunks.

    Technically you could send more if you use compression.

    The alternatives to send larger messages mentioned by @Walter Coan are valid alternatives.

    so:

    1. Will a higher tier allow for a larger size? No. Maximum size is 256KB.
    2. Would not an edge module break it down to smaller chunks before sending up? or Yes, but the chunks is just for the message count administration. The maximum size stays 256KB.
    3. Is there a solution / recommendation to break down a message which IoT Hub can put back on the cloud side? Compression increases the possible message size. You need to send the message in multiple parts yourself (eg. with a correlation ID and part number)
    4. I saw another article which said that if we send a large message, the daily limits will be considered based on 4KB chunks. Does that mean a 256KB message will be considered as 65 thousand message rather than a single message when accounted against the daily limits of the tier? 256 devices by 4 is 64 chunks thus 64 'messages' are counted for the daily quota. So, larger message require more units for a given tier.

    What I have seen with customers is that a subset of the telemetry is sent to the cloud for remote monitoring via filtering/aggregation on the edge. If all messages are needed in the cloud, separate (custom) logic is used to collect batches of messages (say 10.000 messages or 10 minutes of messages) and send them over a separate channel (eg. the blob storage solution on the edge).


    If the response helped, do "Accept Answer". If it doesn't work, please let us know the progress. All community members with similar issues will benefit by doing so. Your contribution is highly appreciated.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.