How to process more messages in the queue


(Kedar Nagella) #1

Hi,

Our team is using nservicebus and need some help.

We have nservicebus over MSMQ. Producer / publisher puts lot of messages in the queue and we have handler but sometimes there are too many messages in the queue. So what options does nservicebus provide to speed up processing message in the queue, does nservicebus call multiple instances of the handler, can we replicate handlers.

thanks,
Kedar.


(Sean Feldman) #2

Hi Kedar,

You can look into scaling out your processing endpoints and use sender-side distribution.
Here’s a documentation link that would give you and idea how it works.


(Ramon Smits) #3

Hi Kedar,

It is important to understand what your current bottleneck is. Just increasing the concurrency and/or scaling out is not necessarily the fix for your throughput issue. For example, if your database is the bottleneck, scaling out your endpoints or increasing the maximum concurrency will only make things worse.

Which version of NServiceBus are you using? Prior to V6 NServiceBus would by default process message sequentially. Version 6 onwards the default concurrency is equal to the amount of cores on the machine.

If your endpoint still has enough CPU, RAM and network resources you might want to increase the maximum allowed concurrency. I personally experienced good results between 2 and 4 times the amount of cores on a machine but it depends on many factors.

If increasing the concurrency doesn’t help you could spread out our endpoints over multiple machines. For example, you currently have 10 endpoints on a single machine, consider using a single machine per endpoint. Once your endpoint runs on a single machine and still isn’t providing enough throughput I would consider scaling out this endpoint as suggested by @SeanFeldman

Regards,
Ramon


(Dennis van der Stelt) #4

Hi @Kedarnag,

Please also specify the version of NServiceBus you are using and which transport. Besides the questions @ramonsmits posted, how many is “too many messages”? Please provide some information about the average throughput you have.

Regards,
Dennis