Load Testing Applications that use MSMQ

Recently we wanted to test a part of the system under load. The load did not need to be specifically distributed or a simulation of a number of users and sessions etc, we just needed some load while we performed some other tests to observe the results.

We realised that the quickest way to do this was to load up one or more of the MSMQ Queues and let the system process the incoming messages. This gave us the load we needed and in turn we could quickly perform the testing and verify our plans.

How to Load Up MSMQ

Do note that we are not talking about "testing" MSMQ here, its about loading up the system that uses it and observing the results.

We found the quickest way was to turn on the Journal for the relevant queues, perform some actions, then using MSMQ Inspector, "copy" and "bulk paste" the journal messages back onto the queue.

If the Journal is not enabled, use Manage Queue to enable it – then perform some actions that will generate some messages that we can use for the loading up of the system:

MSMQ Inspector - Manage Queue

Next, open up the Journal Queue and select some messages that we can “re-play”:

MSMQ Inspector - Copy selected messages

Now – go back to the actual Queue and select the Bulk Paste option. This will put a copy of the selected Journal massages back onto the queue:

MSMQ Inspector - Bulk Paste

You will see a "Bulk Send" dialog, just enter the number of copies you want. If you have 3 messages selected for the bulk paste, selecting 10 here will add 30 messages:

MSMQ Inspector - Bulk Send

Sit back and watch your system grind away processing messages... One of the recent additions was the Bar Graph View - this is a simple way to watch the message count go up and down. It may make things easier to open multiple coppies of MSMQ Inspector with the different views setup, use multiple monitors etc.

We found this process a nice and quick way to test out certain behaviours.

Paste 100,000 messages...? Yes, if you want :-)