Closed ZWMiller closed 1 year ago
Hi @ZWMiller ,
Thank for the issue. The documentation around this is certainly a bit difficult to find, but when messages are large batching is not supported by the service for performance reasons etc. It is recommended that you continue to send those messages individually.
Hi @ZWMiller. Thank you for opening this issue and giving us the opportunity to assist. We believe that this has been addressed. If you feel that further discussion is needed, please add a comment with the text “/unresolve
” to remove the “issue-addressed” label and continue the conversation.
Hey @kashifkhan . Thanks for the note and link. If I might make a recommendation, it would be helpful to have in the documentation what is considered a large message. I had read that section, but assumed that large message was 50-100MB. If I understand the source correctly, it looks like anything over 256kb is considered a large message for the purposes of batching. That information being in the docs would help solve for the issue.
Thanks again.
Hi @ZWMiller, I agree with you around the confusion in that section. In the SDK docs we avoid putting down firm numbers since the limits/quotas can be changed by the service and we get limits etc. from the service during run time so that we can adjust on the fly.
On the SDK side we can link out to that document and I'll ask the service team if they can add some clarity around that particular section regarding what is a big message vs someone going over the limit of their subscription (standard versus premium).
The confusing aspect here itself is that the batch or the envelope in which the messages are delivered itself has a size limit and the messages have a size limit on the tier level.
@kashifkhan That would be great. I think some acknowledgement in the docs/source code for ServiceBusMessageBatch that the limit is set by the handler, be it AMQP or other. That was the hardest part for me to track down when trying to figure out if I was doing something wrong or there was some hidden limitation. That implied size limit being tied to the handler abstracts a lot of the information around the behavior out of the class - which makes it very hard to track down.
Anyways, I'll stop making suggestions now. Appreciate your time. Cheers.
Describe the bug
I want to send a bunch of large JSON files to a ServiceBus Queue. Each JSON is ~800 kB. The subscription is premium, so I have 100MB limit in message size and the queue is set to 80GB max size. If I put all of these messages into a single JSON array and then send that array after compression to bytes with
sender.send_messages(ServiceBusMessage(compressed_json))
it works fine. The messages in total are <40MB.However, if I instead create a ServiceBusMessageBatch and add the messages 1 at a time with
batch.add_message(ServiceBusMessage(comp_json))
and then try to send the batch withsender.send_messages(batch)
I receive this error:azure.servicebus.exceptions.ServiceBusError: Handler failed: Data set too large for a single message..
The message is still less than the 100MB limit on maximum message size.
I also tried creating the batch by making a list of messages and letting the sender auto-batch with:
with the same error result. I believe there is some problem with the interplay between AMQP message size limits and the ServiceBus stated limit which only applying when ServiceBusMessageBatch is created instead of sending one single large message, but haven't been able to track down the exact problem other than ServiceBusMessageBatch seems to not subdivide properly, which AMQP tries to do to send.
I have also tried this without the compression and the same problem occurs, even when the message is just a string of valid JSON.
To Reproduce Steps to reproduce the behavior:
batch.add_message(ServiceBusMessage(large_object))
. Make sure it's a few objects. I've seen this happen with as few as 2 objectsAlternate method
batch.append(ServiceBusMessage(large_object))
. Make sure it's a few objects. I've seen this happen with as few as 2 objectsExpected behavior Since the limit on my ServiceBus is 100MB, I expected the batch to send successfully
Additional context
Additional Trace: