Monday, July 12, 2010

Quick load testing with the Camel Dataset component

A pretty common thing I have to do is investigate issues that only occur when load is put on a system. Instead of hand coding message producers to pummel a Camel route or message broker, I've been using the Camel dataset component. I'm not sure many are aware of it but its an incredibly useful and easy to use tool.

For demonstration's sake let say we want to send 10000 messages in a tight loop to a ActiveMQ broker started on the local machine. First we download ActiveMQ

So we first create a SimpleDataSet #1 with a size of 10000. This means that 10000 messages will be sent when we use this is the route. We also need to configure the connection to the ActiveMQ broker #2 that we will be pummeling. Finally, we have a Camel route that sends 10000 messages to a queue named myQueue #3. We also have another route that consumes from the same queue and dumps the message contents to the /tmp directory. You can run this now by issuing mvn camel:run on the command line. You will see output something like: