azure-service-bus-java icon indicating copy to clipboard operation
azure-service-bus-java copied to clipboard

Missing `CompleteBatch` in Java library

Open galdreiman opened this issue 6 years ago • 5 comments

The ServiceBus java library is missing the CompleteBatch method that exists in the C# SerbviceBus library.

For processes that depend on receiving messages from the service bus, this is a major performance bottleneck since completions require a request for every single message, significantly impacting performance. This is especially strange since receiveBatch is supported. So processes can receive many messages in a single request, but completing all of them requires individual requests.

We did some benchmarking on this, and it seems that even the premium service bus instances (at 690$/Month/MU) are capable of supporting only a few tens of thousands of requests a minute. Because a request is required per message, there are tens of thousands of requests. So the completeBatch is a crucial in order to reduce the number of requests.

galdreiman avatar May 27 '18 14:05 galdreiman

Not having this functionality kills our server daily, we do all other operations with batches and having to delete each message by its own puts a stress on our service bus instance

hope4555 avatar May 29 '18 10:05 hope4555

This java library is AMQP only, whereas the C# library is not. ReceiveBatch is just a facade and only for convenience. Internally messages are received one at a time. That is how AMQP works. Technically it should have the same performance as receive() called in a loop, with prefetch count set. CompleteBatch has certain limitations. It doesn't work when messages being completed are from different partitions of the same partitioned entity. That's the reason we didn't do it yet. We will take it as an enhancement request and include it in our roadmap.

yvgopal avatar Jun 08 '18 19:06 yvgopal

Thank you for the answer. Right now we deal with overloaded SB. Is there other alternative way we can use in order to reduce the overload?

galdreiman avatar Jun 10 '18 12:06 galdreiman

@galdreiman What's your throughput requirement? How many messages / second? And have you tried scaling up the premium namespace all the way to 4 MU?

nemakam avatar Jun 11 '18 19:06 nemakam

We have implicit batching of complete calls on the service. It is not perfect but improves performance quite a bit. If you are noticing that your SB namespace is overloaded, I would advise you to also look at other factors too, not just the number of complete calls.

yvgopal avatar Jun 12 '18 21:06 yvgopal