Azure Bus Performance

I am trying to improve bandwidth in a Windows service using Azure Service Bus. I noticed that if I have code like this.

 client.OnMessageAsync(async message =>
            {
                var timer = new Stopwatch();
                timer.Start();
                bool shouldAbandon = false;
                try
                {
                    // asynchronouse processing of messages
                    await messageProcessor.ProcessAsync(message);
                    Interlocked.Increment(ref SimpleCounter);
                    // complete if successful processing
                    await message.CompleteAsync();
                }
                catch (Exception ex)
                {
                    shouldAbandon = true;
                    Console.WriteLine(ex);
                }

                if (shouldAbandon)
                {
                    await message.AbandonAsync();
                }
                timer.Stop();
                messageTimes.Add(timer.ElapsedMilliseconds);
            },
           options);

If the parameters

OnMessageOptions options = new OnMessageOptions
            {
                MaxConcurrentCalls = maxConcurrent,
                AutoComplete = false
            };

Increasing MaxConcurrentCalls has little effect on a certain number (usually 12-16 for what I do).

But creating multiple clients (QueueClient) using the same MaxConcurrentCalls improves performance (almost linearly).

So what I'm doing is configuring #queueclient and maxconcurrentcalls, but I'm wondering if the best approach is to work with multiple queueclients.

So my question is: does there have multiple queueclients with messages with bad or good practice for windows service and azure service bus?

+4
1

, , , .

, . , .

, , MaxConcurrency , Service Bus - , ( 1 ), .

, , , MaxConcurrency 2x/3x/4x , - , , . MaxConcurrency - , .

, . , , , MaxConcurrency, , , - .

, , "" , MaxConcurrency, , .

0

Source: https://habr.com/ru/post/1648180/


All Articles