Azure-iot-sdk-csharp: Able to exceed max batch size with DeviceClient.SendEventBatchAsync()

Created on 22 Aug 2018  路  6Comments  路  Source: Azure/azure-iot-sdk-csharp

Hi,
I am using Microsoft.Azure.Devices.Client v. 1.6.2. In document https://github.com/MicrosoftDocs/azure-docs/blob/master/includes/iot-hub-limits.md it is stated that maximum size of device-to-cloud batch is 256KB. However using SendEventBatchAsync() I am able to send batches a lot bigger. The limit of 256KB seems to apply to single message but I was able to send a batch of 50 messages, each being 255KB in size. Is there an error in documentation I referred or have I misunderstood something? Is this a bug? Do all my messages actually get sent to IoT Hub?

area-documentation question

Most helpful comment

@yzhong94 here's the PR.

All 6 comments

/cc @simonporter @tameraw @jspaith

@jesseik which protocol are you using?

  • MQTT seems to simply send each message separately - no batching so it should only be limited by single message size.
  • AMQP uses an AmqpBatchedMessageFormat which should be limited by the batch size..
  • HTTP will attempt to POST all messages in a single JSon which should also be limited by the batch size.

@CIPop thank you for your answer. I am using MQTT protocol so this behavior would make sense. Is SendEventBatchAsync() with MQTT implemented like this because of some limitation in the protocol?
Anyway this answered my question, thanks! Should this be mentioned in a document though?

@rezasherafat can you help update the documentation to reflect this behavior? Thanks

@yzhong94 here's the PR.

Closing this issue as the doc has been merged.

@CIPop, @jesseik, @rezasherafat, thank you for your contribution to our open-sourced project! Please help us improve by filling out this 2-minute customer satisfaction survey

Was this page helpful?
0 / 5 - 0 ratings