views:

27

answers:

1

We use IBM MQ6.1. And use IBM API to send Messages to Queue. As we need to send huge number of messages, was wondering if we can use multithreading and send messages to the same Queue. Any suggestions?

A: 

Absolutely. You can have as many threads as memory and CPU will allow. Each thread requires it's own connection handle if you want to see a performance improvement. If you use a single connection handle, all GET and PUT activity from multiple threads is synchronized through the connection handle. If you use many connection handles, the GET and PUT activity can occur in parallel. Please see Multithreaded programs in the WMQ Using Java manual for additional details.

Just make sure that OS kernel settings like MAXUPROCS are set to allow WMQ to run sufficient threads to receive the connections and that WMQ settings like MAXHANDS and MAXCHANNELS are bumped up to accommodate the load. Keep in mind that units of work are thread-scoped so each thread is independent of the others for syncpoint - for example, when you issue COMMIT inside a thread it only commits the messages put by that particular thread assuming it has a dedicated connection. The queues have an attribute for DEFSOPT (default share options) but this relates to how many input handles can be active. Even if you open the queue for exclusive input, you can have many threads writing to it.

Also, v6.x of WMQ will be end-of-life as of September 2011. Start planning now to get to v7 to remain on a supported version. If you are using WMQ Client connections, upgrade the client as well as the QMgr. The v7 Client works fine with a v6 QMgr and can be upgraded independently. Of course it supports only the v6 functionality when used with a v6.x QMgr. You can download the v7 client as SupportPac MQC7.

T.Rob
I guess I did not put the question correctly.. I am writing a java program to connect to queue and send messages. and was trying to know if I can send the messages in multithreaded way to the same queue rugginng on a remote IBMMQ server.
Yes. That's how I interpreted the question. I've updated the answer to explain that the many threads all need their own connection and provided a link to the manual section that discusses this topic.
T.Rob