ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Installation/Configuration Support » Pooling Queue Objects

Post new topic  Reply to topic
 Pooling Queue Objects « View previous topic :: View next topic » 
Author Message
yalmasri
PostPosted: Sat Jul 19, 2008 6:54 am    Post subject: Pooling Queue Objects Reply with quote

Centurion

Joined: 18 Jun 2008
Posts: 110

Hi,

I'm wondering if there is any problem caching the MQQueue objects returned from MQQueueManager.accessQueue(...) and using them in a multi-threaded environment, so instead of each time retrieving the queueManager from the pool, accessing the queue, then getting or putting any messages, I'd pick up the queue object itself and get or put messages on it straight ahead.

Is there anyone who discourages this practice? Any precautions for this like simultaneous access to same queue object or sharing it between threads? Of course any number of MQQueue objects will be retrieved from an equivalent number of different MQQueueManager objects.
Back to top
View user's profile Send private message
sridhsri
PostPosted: Sat Jul 19, 2008 6:59 am    Post subject: Reply with quote

Master

Joined: 19 Jun 2008
Posts: 297

It would depend on how that queue was opened. If the queue was opened in EXCLUSIVE mode, then other threads wont be able to access it.
Back to top
View user's profile Send private message
yalmasri
PostPosted: Sat Jul 19, 2008 7:22 am    Post subject: Reply with quote

Centurion

Joined: 18 Jun 2008
Posts: 110

So if in shared mode, what is the difference between saying:

new MQQueueManager("QM_1").accessQueue(...).get(MQMessage,corr_1);
new MQQueueManager("QM_2").accessQueue(...).get(MQMessage,corr_2);

and

MQQueue q = new MQQueueManager("QM").accessQueue(...);
Thread_1.q.get(MQMessage,corr_1);
Thread_2.q.get(MQMessage,corr_2);

Is there any performance gain for example?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sat Jul 19, 2008 12:34 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

yalmasri wrote:
So if in shared mode, what is the difference between saying:

new MQQueueManager("QM_1").accessQueue(...).get(MQMessage,corr_1);
new MQQueueManager("QM_2").accessQueue(...).get(MQMessage,corr_2);

and

MQQueue q = new MQQueueManager("QM").accessQueue(...);
Thread_1.q.get(MQMessage,corr_1);
Thread_2.q.get(MQMessage,corr_2);

Is there any performance gain for example?

There is a big difference.
While retrieving and serving up a message your connection will be synchronized...
So having multiple threads read from the same queue on the same connection will only speed up by the time spent in processing the message. If you use a connection by thread you engineer true parallelism and not a single threaded process with a fork...

Having multiple threads read from the same connection would be like having a single thread read from the connection and spawning off a new one to process the message once retrieved...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
yalmasri
PostPosted: Sat Jul 19, 2008 10:16 pm    Post subject: Reply with quote

Centurion

Joined: 18 Jun 2008
Posts: 110

And what's your advice fjb_saper about pooling queue objects?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Jul 20, 2008 2:57 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

yalmasri wrote:
And what's your advice fjb_saper about pooling queue objects?

Not necessary or you would have a pool delivered in the MQ package.
Pool the connections.
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
yalmasri
PostPosted: Mon Jul 21, 2008 10:54 pm    Post subject: Reply with quote

Centurion

Joined: 18 Jun 2008
Posts: 110

Any particular reason? I mean on the technical level rather than logical
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Installation/Configuration Support » Pooling Queue Objects
Jump to:  



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
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.