Hello,

You can certainly create multiple JMS sessions over the same JMS connection. 
That is no problem, assuming we don't talk about hundreds of sessions to be 
used over the same connection. Its certainly recommended to use long running 
connections and not reconnect for every new msg. Also, consider the use of a 
PooledConnectionFactory and the failover: protocol.

If all these queues are used by the same JMS client process, then one 
connection into the broker is sufficient. Different JVMs would have to create 
their own JMS connection.

I further assume that each queue will be used by different parts of your 
application. So you may want to create a session for each such part and 
construct your producers/consumers from these sessions. 


> In general,
> #1 - what is the effect of increasing the number of session's of one
> connection ?
>       (Is there any limit on this ?)

There are surely limits for everything but have a few dozen sessions on the 
same connection should not cause any problems.

> #2 - what is the effect of increasing the number of connection's  for a
> broker ?
> (Assumption : i guess we can create multiple connections for 1
> broker..right?)
>       (Is there any limit on this ?)

Each connection into the broker causes it create an extra thread that handles 
this connection. So you generally want to avoid creating too many connections 
if possible. It saves resources inside the broker and JMS client. 
However with the right broker tuning you can have a few thousand connections 
into the broker and still run stable. But requires proper tuning.
As a general rule of thumb: Avoid creating too many connections into your 
broker and share multiple sessions over the same connection.

Hope this helps.


Torsten Mielke
[email protected]
[email protected]


On Mar 6, 2012, at 1:59 PM, sreekar wrote:

> Hi Guyz,
> 
> I am trying to use the Active-mq in our application, architecture of
> application is 3-Tier.
> 
> We need a bunch of queues to be configured for the application.
> 
> The queue_name will be in format of <server>.<queue_name>
> Ex: DB.DBQ1, DB.DBQ2  etc  #  Queues in DB Server
>     AP.APQ1, AP.APQ2  etc  #  Queues in APP Server
>     PS.Q1, PS.Q2   etc        #  Queues in Presentation Layer.
> 
> I am thinking of the following scenarios : 
> 
> #1 -  Create one connection
>        Create one session
>        Create all the required Queues (for ALL Servers)
> #2 -  Create one connection
>        Create one session for each server 
>        Create Queues for each server in their corresponding session
> #3 -  Create on connection for each server
>        Create one/more session (# for sub-grouping with in the server)
>        Create  queues in the using the session(s) created under the
> connection (created for each server).
> 
> Could you guys please help me out in finding the best (well-managed)
> solution for the above scenario ?
> Which is best among the 3 (above mentioned) scenarios ?
> Is there any other better way to do this job?
> 
> On what grounds we can say which is the best option?
> 
> In general,
> #1 - what is the effect of increasing the number of session's of one
> connection ?
>       (Is there any limit on this ?)
> #2 - what is the effect of increasing the number of connection's  for a
> broker ?
> (Assumption : i guess we can create multiple connections for 1
> broker..right?)
>       (Is there any limit on this ?)
> 
> Any help would be appreciable.
> 
> Thanks & Best Regards,
> Sreekar
> 
> 
> --
> View this message in context: 
> http://activemq.2283324.n4.nabble.com/Effects-of-the-session-count-and-connection-count-tp4449775p4449775.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.




Reply via email to