Author |
Message
|
tapak |
Posted: Wed Sep 13, 2006 1:03 pm Post subject: JMS Performance on Client connection |
|
|
 Centurion
Joined: 26 Oct 2005 Posts: 149 Location: Hartford,CT
|
I am creating 5 threads to read messages from the queue . Should I create a separate client connection for each thread or can I use the same connection for each thread . Which is better configuration for performance . What are the factors to be considered in determining the no of client connections to a queue manager. |
|
Back to top |
|
 |
mvic |
Posted: Wed Sep 13, 2006 1:25 pm Post subject: Re: JMS Performance on Client connection |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
tapak wrote: |
I am creating 5 threads to read messages from the queue . Should I create a separate client connection for each thread or can I use the same connection for each thread . Which is better configuration for performance . What are the factors to be considered in determining the no of client connections to a queue manager. |
If you use one JMS Connection, and create 5 Sessions from the Connection, this will result in 5 MQI HConns being used. Each of these can be used independently - ie. you can use each Session on its own thread, and there will be no need to serialize between them. Did this answer your question(s)? |
|
Back to top |
|
 |
tapak |
Posted: Wed Sep 13, 2006 1:46 pm Post subject: |
|
|
 Centurion
Joined: 26 Oct 2005 Posts: 149 Location: Hartford,CT
|
Thanks Vic ,
Instead of creating 5 sessions , is it possible to create 5 Reciever objects in different threads from a single session (single connection). If yes , does it perform better compared to using 5 connections in different threads. |
|
Back to top |
|
 |
fjb_saper |
Posted: Wed Sep 13, 2006 4:06 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
For reason of transactionality I would not create 5 receivers from the same session. On top of this, as the threads would read from the same queue, they would be single threaded for receiving messages from the queue. Exactly what you want to avoid...
Creating a session from a connection consumes nearly no time. Establishing the connection is costly.
Create 5 runnable objects and pass in the connection. Let each thread then create it's own session.
Enjoy  _________________ MQ & Broker admin
Last edited by fjb_saper on Thu Sep 14, 2006 2:46 pm; edited 1 time in total |
|
Back to top |
|
 |
mvic |
Posted: Thu Sep 14, 2006 1:07 am Post subject: |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
tapak wrote: |
Instead of creating 5 sessions , is it possible to create 5 Reciever objects in different threads from a single session (single connection). |
If I remember correctly, JMS disallows use of the same Session concurrently on more than one thread. I expect you'll be allowed to create 5 Receivers, but you'll not be allowed to call them concurrently. |
|
Back to top |
|
 |
tapak |
Posted: Fri Sep 15, 2006 5:35 am Post subject: |
|
|
 Centurion
Joined: 26 Oct 2005 Posts: 149 Location: Hartford,CT
|
|
Back to top |
|
 |
tapak |
Posted: Fri Sep 15, 2006 5:38 am Post subject: |
|
|
 Centurion
Joined: 26 Oct 2005 Posts: 149 Location: Hartford,CT
|
Does Java MQ API can be used to create threads using a single client connections. |
|
Back to top |
|
 |
jefflowrey |
Posted: Fri Sep 15, 2006 5:46 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
You can only perform one operation at a time over a single connection. So if you use the same connection in two threads, and one thread is doing a GET with WAIT, the other thread is blocked until the GET returns. _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
tapak |
Posted: Fri Sep 15, 2006 6:01 am Post subject: |
|
|
 Centurion
Joined: 26 Oct 2005 Posts: 149 Location: Hartford,CT
|
So if the transaction is simple it is better to use separate connection for each thread. And if the transacion is complex (like lot of database operations) same connection can be used in multiple thread for Java API. Am I right ? |
|
Back to top |
|
 |
|