activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Strachan" <>
Subject Re: Spring JMS Scalability - Newbie questions
Date Fri, 12 Oct 2007 09:50:27 GMT
On 11/10/2007, VJ22 <> wrote:
> Hi All,
> I have just implemented a messaging system using Spring JMS with Active MQ
> 4.1.1...I do have some questions...Would be appreciable if someone could
> answer them
> We are looking at processing close to 100000 transactions in a
> minute...Heres my settings
> -> 1 Message Listener Container with 300 concurrent consumers of a
> particular class configured via a MessageListenerAdapter

If you are using the MessageListenerContainer and want high
performance you should ideally set the cache level to "CONSUMER" -
then consumers are reused (rather than being created & destroyed each
time along with the session (and connection too if you don't use
CONNECTION caching or the PooledConnectionFactory).

Note though that there's currently a bug in Spring if you're expecting
to use JMS transactions to consume then send in the same session...

Also if you want to use a single JMS session (to avoid XA) make sure
you reuse the same JMS session on both the JmsTemplate and

> -> Connection Factory is "org.apache.activemq.pool.PooledConnectionFact ory"
> My question is whether the connection factory usage is OK? I have read at
> many places that the connection factory usage should be ideally via JCA due
> to better resource management. Also, the PooledConnectionFactory should be
> ideally used for producing and not consuming. I do not want to use Jencks as
> we will be migrating to Spring 2.1 which has got the requisite JCA Features.
> Also is there any other alternative ?

The Spring MessageListenerContainer stuff is fine - provided you set
it up and configure it correctly. FWIW we use it as the JMS consuming
component in Camel to provide EIP integration...

> Secondly, I presume when I mention 300 consumers, 300 parallel threads are
> automatically there a way to mention if each thread should
> automatically prefetch a set of messages and process them ?

Yes - ActiveMQ client does that automatically.

> Also is 300
> consumers a lot ?

It depends on your platform and what the consumer does; i'd experiment
with the number and see which one performs best. Sometimes on some
platforms (particularly solaris) the thread context switching often
outweighs the extra parallelism. Sometimes if your consumer is just
doing database stuff, your database often dictates how parallel you
should be for optimum performance.

If you have a high number of consumers; with a high prefetch - you may
use up too much RAM BTW (and sometimes starve the queue) so you might
want to experiment lowering the prefetch or consumer count if RAM is


Open Source SOA

View raw message