Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm using MassTransit as my messaging framework, running on top of Azure Service Bus. I'm running MassTransit from inside a WebJob (although I don't think that matters)

Now I'm trying to get MassTransit to process multiple messages at the same time, as I'm now dealing with messages that individually take a while to process. So to speed up performance, I don't want each message to be processed one by one.

I tried setting MaxConcurrentCalls to , for example, 30, but that doesn't seem to do it. Messages are still picked up by my consumer one by one.

I also tried setting the PrefetchCount to 5 etc, but it doesn't change anything.

What am I doing wrong? Any help is greatly appreciated

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
216 views
Welcome To Ask or Share your Answers For Others

1 Answer

So, I did some testing using MassTransit-Benchmark, and I'm able to get many concurrent consumers executing with Azure Service Bus using MassTransit 3.4.1.

With that in mind, realize that Azure is not fast, so if your consumer is doing nearly nothing (and completes in less than a few ms), it's unlikely that you'll see more than one at a time due to how poorly message delivery is with service bus. I had to add a delay of 3ms to the consumer to get up to 70-80 concurrent consumers. Without the delay, it was sitting around 2-3 concurrent consumers.

So, consider adjusting some settings. Also, there is a batch timeout you can set on the host that will help if you reduce it to under 10ms, even 5ms, if you are doing may small messages. A higher prefetch count helps as well.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...