TagAzure

Multiple message receivers with Azure Service Bus

M

In the first post of this series we looked at a simple message receive loop. We tried to optimize the receive loop by moving out the message completion into a dedicated background operation. It turns out we can do more to boost the message throughput. Here is how our simple loop looked like We created a queue client with QueueClient.CreateFromConnection. If we carefully read the best practices for improvements using Service Bus Messaging we can see that there are multiple ways of creating queue...

Improved batch completion loop for Azure Service Bus

I

In the last post, we created a dedicated completion loop inside a worker thread to complete messages in batches. There are a few obvious or not so obvious things we can improve in our code. But first, how did it look like again? We could make a simple assumption: If the numberOfItems returned by TryPopRange is equal the maximum lock token range we want to complete in batches (here one hundred) then we have potentially more things to complete, and we can try to avoid the delay. So if we were...

Another attempt to batch complete with Azure Service Bus

A

In the last post, we tried to be smart with batch completion and completed every one-hundredth message. Unfortunately, this way of doing completion might not work under with few messages in the queue. We decided to go back to the drawing board and see if we can come up with a better approach which can cope with high but also small loads of messages. The heart of the code we wrote in the last post (omitting the exception handling part) looks like Instead of completing messages in batches of...

Let’s try batch completion of messages on Azure Service Bus

L

In the last post, we deferred the message completion task into the background to remove the additional latency from the message receive callback. This time we want to save even more latency by batching multiple message completions together into a single Azure Service Bus broker call. It turns out this is possible with the Azure SDK. The MessageReceiver has a method called CompleteBatchAsync which accepts an IEnumerable<Guid> called lockTokens. But where do we get these lock tokens from...

Defer message completion on Azure Service Bus

D

In the last post, we started sketching code around the idea of deferring the actual message completion out of the message receive callback. A simple way to achieve our goals would be to kick off the completion task without await it like the following code shows This is inelegant in multiple ways. Since the code is contained in a delegate which is marked as async, the compiler would warn us with CS4014 that the call is not awaited. Of course, we could work around that by suppressing the compiler...

Latency to Azure Service Bus matters

L

In the last post, we optimized the throughput on the client by increasing the concurrency of the message receive loop. What else could we try to improve? Let’s have a closer look at the lambda body of the OnMessageAsync declaration. As we can see, we have technically two operations inside the callback delegate. The first operation is the code we want to execute when a message is pushed to us (here represented with comment). The second operation is the completion or abandon of the message...

Let’s save our Thanksgiving sales with Azure Service Bus

L

As we saw in the last post, naive receiving of messages with Azure Service Bus destroys our Thanksgiving sales. But how can we do better to satisfy our bosses and first and foremost our precious customers? As Sean Feldman rightfully pointed out in the comments section, our sample was using MaxConcurrentCalls set to one. How silly! Who wrote that… Oh, it was me 😉 So how about we correct my mistake and set to 100 to like the following With this tiny change, we can suddenly receive 100...

Don’t spoil your Thanksgiving sales with naive Azure Service Bus client code

D

Edit: The initial title was: “Naive receiving of messages on Azure Service Bus destroys Thanksgiving sales” I changed it because I don’t want to imply that Azure Service Bus as a service is not behaving correctly. Sorry if this cause any inconvenience.  The Azure Service Bus SDK provides a lot of very smart functionality to build robust libraries, frameworks and application code on top of Azure Service Bus. In the most simplistic scenario, you write code like This code...

Stay cool! Save Money. Backup your Synology Diskstation to the cloud using Azure Cool Storage

S

You are sitting in your living room with good friends. Your last vacation, how quickly your kids grew up or your last outdoor adventure is the hot topic of the evening. Notorious like you are you have documented many of your life’s moments with your cell phone or your fancy digital camera. All your pictures are safely stored on your network disk station. Showing these pics to your friends is simple. Browse to your disk station with your TV and show the beautiful photographs in full...

Recent Posts