I am learning about NServiceBus and MSMQ. I was told that transactional queues in MSMQ are BAD and using them is really bad for performance. Does anyone know why? I am guessing this comes from the notion that it uses DTC and everyone knows that the DTC is not really a scalable solution. It seems to me that there are a couple of reasons that MSMQ with NServiceBus is not all that bad, but I don't know if I understand how it works completely. Looking at this logically, I can think of 3 places where NServiceBus might use transactions in order to get guaranteed delivery:
Can anyone set me straight as to how NServiceBus does this?
Msmq transactions do not guarantee that the receiver has received the message. The transaction guarantees that the message has been received by the msmq infrastructure on your machine, and if the message is durable (the default in NSB) this means that it has been persisted on disk and will survive a restart. The message will then be delivered by msmq without blocking the caller. This is better known as "store and forward"
By default MSMQ only guarantees that your local msmq infrastructure has received the message. No requirement that the receiving servers are online. This can be enabled though(see the answer from John below)
This is IMO one of the key selling points of NSB. The ability to use transactions that spans both the local queue and your datastore (Ie distributed transaction) is crucial to guarantee consistency. Ie if something fails nothing is persisted in your data store and the message is rolled back and retried without the user having to do anything.
Same as #1. The only guarantee is that each subscriber will eventually receive the published message. No blocking calls are made so as long you have free disk space and the publishing server the call will return immediately.
Hope this helps!
Point #2 is correct. You don't want a message to cause an error and then fall through the cracks. You want the message handler to succeed, in which case it is removed from the queue, or to fail and be rolled back, so that it can either be retried or sent to an error queue for analysis after a configurable number of retries has been reached.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With