Posted: Wed Aug 18, 2004 10:56 am Post subject: MQ Open/Access Q and Close Q performance
Novice
Joined: 05 Aug 2004 Posts: 13
Hi,
In my Java program, I get a message from a queue and then process it and repeat this as long as there are messages in the queue. The program would run 24/7 and would shutdown only in case of certains error conditions while processing. Now my question is the sequence of operations when I do this:
Code:
Scenario 1:
Connect to Q Mgr at startup
Repeat the following steps for each GET:
Access/Open a Q
GET a msg
Close the Q
Disconnect from the Q Mgr at shutdown
Scenario 2:
Connect to Q Mgr at startup
Access/Open a Q
Repeat the following steps for each GET:
GET a msg
At shutdown:
Close the Q
Disconnect from the Q Mgr
Now in terms of performance, it would seem that the "Scenario 2" is better because you only incur the cost of Open/Accessing and Closing the Queue once and not for every GET as in the case of "Scenario 1". But when I performed the tests I didn't see much of a performance difference between the two scenarios. So was wondering what Scenario should I implement? Is there anything that would weigh in favor of one Scenario over the other?
Joined: 11 Aug 2002 Posts: 4055 Location: Hyderabad, India
It also helps if you can tell what OPEN options you are specifying when you open the queue.
Scenario 2 is better if you open the queue in shared mode and want to run/ be able to run multiple copies of it.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum