You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by Guillaume Nodet <gn...@gmail.com> on 2006/12/03 19:59:33 UTC

Connection pooling

Over the past days, I worked on improving the connection pooling in
ActiveMQ, mainly for outbound.  I found that:
  * the o.a.a.pool package has a limited throughput when using persistence
     messaging, because all threads reuse a single connection, but the broker
     will handle the messages sequentially, so the throughput of using a single
     transaction in multiple threads is the same as using a single thread.
 * the activemq resource adapter used for outbound is really slow (using
    jencks), because the connection is completely reset after each use.  The
     connection infos need to be sent each time + creation of an
advisory consumer
     on the connection, + createion of the session + creation of a
producer.  These
    operations are very cpu intensive on the broker side (no real idea
why).  I think
    this should be improved by pooling sessions / producers.

For my current needs, I have enhanced the o.a.a.pool package to support
enlisting the current session in an active xa transaction, and by allowing
several connections to be used to raise the global throughput.
I have also added in jencks a derived pooled connection factory which
is compatible with jencks jca inbound support (the main problem is that
the XAResource#isSameRM need to work and recognize that the inbound
connection and outbound connection use the same RM).

My last thought is that i wonder if the org.apache.activemq.pool package
should be in its own module because it has its own set of dependencies
in addition to the standard jms client (commons-pool mainly) which can
lead to problems with classloaders.

-- 
Cheers,
Guillaume Nodet

Re: Connection pooling

Posted by Guillaume Nodet <gn...@gmail.com>.
Note that jmx was enabled, so that i have seen mbeans
being created / destroyed for each message sent using jca outbound
(one of them was the advisory consumer iirc).  That may be related to cpu
usage.

On 12/3/06, Rob Davies <ra...@gmail.com> wrote:
> Thanks Guillaume!
>
> I'll look at why it's so cpu intensive to create a connection +
> session + producer on the broker side
>
> cheers,
>
> Rob
> On 3 Dec 2006, at 18:59, Guillaume Nodet wrote:
>
> > Over the past days, I worked on improving the connection pooling in
> > ActiveMQ, mainly for outbound.  I found that:
> >  * the o.a.a.pool package has a limited throughput when using
> > persistence
> >     messaging, because all threads reuse a single connection, but
> > the broker
> >     will handle the messages sequentially, so the throughput of
> > using a single
> >     transaction in multiple threads is the same as using a single
> > thread.
> > * the activemq resource adapter used for outbound is really slow
> > (using
> >    jencks), because the connection is completely reset after each
> > use.  The
> >     connection infos need to be sent each time + creation of an
> > advisory consumer
> >     on the connection, + createion of the session + creation of a
> > producer.  These
> >    operations are very cpu intensive on the broker side (no real idea
> > why).  I think
> >    this should be improved by pooling sessions / producers.
> >
> > For my current needs, I have enhanced the o.a.a.pool package to
> > support
> > enlisting the current session in an active xa transaction, and by
> > allowing
> > several connections to be used to raise the global throughput.
> > I have also added in jencks a derived pooled connection factory which
> > is compatible with jencks jca inbound support (the main problem is
> > that
> > the XAResource#isSameRM need to work and recognize that the inbound
> > connection and outbound connection use the same RM).
> >
> > My last thought is that i wonder if the org.apache.activemq.pool
> > package
> > should be in its own module because it has its own set of dependencies
> > in addition to the standard jms client (commons-pool mainly) which can
> > lead to problems with classloaders.
> >
> > --
> > Cheers,
> > Guillaume Nodet
>
>


-- 
Cheers,
Guillaume Nodet

Re: Connection pooling

Posted by Rob Davies <ra...@gmail.com>.
Thanks Guillaume!

I'll look at why it's so cpu intensive to create a connection +  
session + producer on the broker side

cheers,

Rob
On 3 Dec 2006, at 18:59, Guillaume Nodet wrote:

> Over the past days, I worked on improving the connection pooling in
> ActiveMQ, mainly for outbound.  I found that:
>  * the o.a.a.pool package has a limited throughput when using  
> persistence
>     messaging, because all threads reuse a single connection, but  
> the broker
>     will handle the messages sequentially, so the throughput of  
> using a single
>     transaction in multiple threads is the same as using a single  
> thread.
> * the activemq resource adapter used for outbound is really slow  
> (using
>    jencks), because the connection is completely reset after each  
> use.  The
>     connection infos need to be sent each time + creation of an
> advisory consumer
>     on the connection, + createion of the session + creation of a
> producer.  These
>    operations are very cpu intensive on the broker side (no real idea
> why).  I think
>    this should be improved by pooling sessions / producers.
>
> For my current needs, I have enhanced the o.a.a.pool package to  
> support
> enlisting the current session in an active xa transaction, and by  
> allowing
> several connections to be used to raise the global throughput.
> I have also added in jencks a derived pooled connection factory which
> is compatible with jencks jca inbound support (the main problem is  
> that
> the XAResource#isSameRM need to work and recognize that the inbound
> connection and outbound connection use the same RM).
>
> My last thought is that i wonder if the org.apache.activemq.pool  
> package
> should be in its own module because it has its own set of dependencies
> in addition to the standard jms client (commons-pool mainly) which can
> lead to problems with classloaders.
>
> -- 
> Cheers,
> Guillaume Nodet