Azure service bus read performance

雨燕双飞 提交于 2019-12-04 07:35:51

I know this is really old now - but I thought I'd contribute my own findings.

I'm seeing an increase in queue processing performance just by running multiple processes on the same machine. In my case, I'm using console apps, but the principle is identical.

I think ultimately it's because the MaxConcurrency value is ultimately controlling how many messages the Service Bus will hand to a consuming client - when it reaches that limit, it effectively goes to sleep for a period of time (around 1 sec in my experience) before trying to push more messages down.

So if you have a very simple message handler, you're incredibly unlikely to reach capacity even if you set MaxConcurrency to 2x/3x/4x the logical core count, but processing of multiple messages will still be very slow if you push more messages than the client is configured to handle at once. Running another process with the same MaxConcurrency is giving you twice the available capacity - even when on the same machine - but it's not actually giving any more power.

Ultimately, the right configuration is going to depend on the processor usage profile of your queue tasks. If they are long-running and tend to chew through processor cycles, then having too great a MaxConcurrency likely slow you down, rather than up - and scaling out to other machines really will be the only solution.

If, however, your queue tasks are 'sparse' and spend most of their time waiting, then you will be able to get away with a higher MaxConcurrency than there are logical cores in your processor - because they won't all be busy all the time.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!