activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rhavyn <rha...@gmail.com>
Subject Re: Using JMS effeciently in a SLSB
Date Sun, 30 Jul 2006 19:09:01 GMT


James.Strachan wrote:
> 
>> Hello,
>>
>> I am working on integrating a EJB webservice endpoint into our messaging
>> backend.  However I'm having some performance issues.  I'm using ActiveMQ
>> in
>> the GenericJMS Resource Adaptor with Glassfish.
> 
> FWIW ActiveMQ has its own Resource Adapter
> 
> http://incubator.apache.org/activemq/resource-adapter.html
> 
> 

I was aware of that, but as I reported here:
http://issues.apache.org/activemq/browse/AMQ-765 you can't use the ActiveMQ
Resource Adapter in Glassfish.


James.Strachan wrote:
> 
>> The problem I'm having specifically is getting a request/response
>> interaction working at the speed we need it to.  I've spent the past two
>> days looking into it and what I'm seeing is that creating the
>> MessageConsumer is taking a really long amount of time (on the order of
>> 30-50ms).
> 
> These links might help
> http://incubator.apache.org/activemq/how-do-i-use-jms-efficiently.html
> http://incubator.apache.org/activemq/how-should-i-implement-request-response-with-jms.html
> 
> 

I read both of those links carefully.  What I'm basically getting from them,
however, is to open 1 Connection, use 1 Session per thread and cache as many
of the JMS objects as you can in order to improve efficiency.  Since I'm in
an EJB container the only things it seems I can actually cache are the
Connection and the Temporary Queue.


James.Strachan wrote:
> 
>> So, I tried caching the Session, MessageProducer and
>> MessageConsumer as the ActiveMQ wiki recommends,
> 
> If you are using EJB then you should be using JCA so that it's proxy
> ConnectionFactory does the connection/session pooling for you?
> 
> 

That's the theory, and it appears that it's doing some kind of caching, but
it's definitely not caching the MessageConsumer.  Either that or it's
implemented the slowest caching mechanism ever.


James.Strachan wrote:
> 
>> but that also fails because
>> the EJB specification states that an EJB can only have 1 open Session per
>> Connection.  Thus, as soon as a second thread comes a long and tries to
>> open
>> a Session, everything breaks.  Closed Sessions to me no good because they
>> close the MessageConsumer too.
>>
>> Is there some best practice that is generally used when creating a
>> request/response iteraction inside the EJB container?  30-50ms might not
>> seem like much but when you need to send to four or five different queues
>> to
>> complete the webservice call, the 200ms delay causes our website to slow
>> to
>> a crawl.  This is really frustrating because I can make the same set of
>> calls using PHP and Stomp and the whole interaction takes less time then
>> it
>> takes just to instantiate a single MessageConsumer in Java.
> 
> If you are struggling with using JCA/Stomp you might want to just use
> Lingo (http://lingo.codehaus.org/) or write your own code which pools
> the connection/session/producer/consumer for doing request/response
> -- 
> 
> James
> -------
> http://radio.weblogs.com/0112098/
> 
> 

>From what I saw of Lingo I'd be in the same situation as I am now.  I
actually read through their code quite carefully to see what they're doing
and it looked to me that they're also caching the Session.  Doing that will
cause an exception to be thrown as soon as I try to use a second Session on
the same Connection.

Thanks,
--Chris

-- 
View this message in context: http://www.nabble.com/Using-JMS-effeciently-in-a-SLSB-tf2022444.html#a5566112
Sent from the ActiveMQ - User forum at Nabble.com.


Mime
View raw message