activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From janylj <jan...@gmail.com>
Subject Re: Sending message using JmsTemplate with PooledConnectionFactory hangs periodically
Date Tue, 30 Sep 2008 16:23:31 GMT

Thanks a lot, Ari.

If the problem appears to be fixed, do you (or ActiveMQ folks) know where
the problem is? Is it caused by PooledConnectionFactory, since I don't see
any bug fix about PooledConnectionFactory in 5.2.

Jan


Ari Miller-2 wrote:
> 
> I experienced similar issues using the same classes.  I couldn't get
> around
> them, so I upgraded to the tentative 5.2 activemq release candidate (
> http://www.nabble.com/-VOTE--ActiveMQ-5.2.0---RC1-td19411389.html), which
> fixed a number of bugs that might have caused this behavior (
> http://issues.apache.org/activemq/browse/AMQ/fixforversion/11841).
> I load tested with the 5.2 release candidate this weekend, and found that
> the message delivery was evenly distributed (no jamming/release by next
> message) and that it handled load without stalling out.
> 
> Best,
> Ari
> 
> On Mon, Sep 29, 2008 at 5:13 PM, janylj <janylj@gmail.com> wrote:
> 
>>
>> My producer uses Spring's JmsTemplate with PooledConnectionFactory. The
>> Spring configuration is below. Then I send 10 messages every second. And
>> I
>> notice that the producer doesn't send message smoothly. Every so often it
>> would hang for a couple of seconds and then a huge spike of load would
>> come
>> in. For my application, the prompt response time is important. I am
>> expecting smooth throughtput rate instead of big up and downs. Any inputs
>> on
>> the problem?
>>
>>  <bean id="pooledJmsFactory"
>> class="org.apache.activemq.pool.PooledConnectionFactory"
>> destroy-method="stop">
>>    <property name="connectionFactory">
>>        <ref local="jmsFactory" />
>>    </property>
>>    <property name="maxConnections" value="100"/>
>>  </bean>
>>
>>  <!-- Spring JMS Template -->
>>  <bean id="myJmsTemplate"
>> class="org.springframework.jms.core.JmsTemplate">
>>    <property name="connectionFactory">
>>      <ref bean="pooledJmsFactory"/>
>>    </property>
>>    <property name="defaultDestination">
>>      <ref bean="destination" />
>>    </property>
>>  </bean>
>>
>> I am also wondering whether the implementation of PooledConnectionFactory
>> is
>> correct. The reason is that from my profiler, it maxed out 100
>> connections
>> very very soon. And default number of sessions on a single connection is
>> 500. The strange thing is that actually there were only 100 session
>> object
>> in the memory all the time. It doesn't seem that the connection from
>> PooledConnectionFactory is being re-used, otherwise, the chances are
>> multiple session objects per connection should exist.
>>
>> Here is a snippet of code from PooledConnectionFactory. I only see where
>> it
>> adds new connection to the pool. But I don't see where it get the
>> connection
>> from the pool other than when removing connection when
>> pools.size()==maxConnections. Please correct me if I am not understanding
>> PooledConnectionFactory.
>>
>>    public synchronized Connection createConnection(String userName,
>> String
>> password) throws JMSException {
>>        ConnectionKey key = new ConnectionKey(userName, password);
>>        LinkedList<ConnectionPool> pools = cache.get(key);
>>
>>        if (pools == null) {
>>            pools = new LinkedList<ConnectionPool>();
>>            cache.put(key, pools);
>>        }
>>
>>        ConnectionPool connection = null;
>>        if (pools.size() == maxConnections) {
>>            connection = pools.removeFirst();
>>        }
>>
>>        // Now.. we might get a connection, but it might be that we need
>> to
>>        // dump it..
>>        if (connection != null && connection.expiredCheck()) {
>>            connection = null;
>>        }
>>
>>        if (connection == null) {
>>            ActiveMQConnection delegate = createConnection(key);
>>            connection = createConnectionPool(delegate);
>>        }
>>        pools.add(connection);
>>        return new PooledConnection(connection);
>>    }
>> --
>> View this message in context:
>> http://www.nabble.com/Sending-message-using-JmsTemplate-with-PooledConnectionFactory-hangs-periodically-tp19734135p19734135.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 

-- 
View this message in context: http://www.nabble.com/Sending-message-using-JmsTemplate-with-PooledConnectionFactory-hangs-periodically-tp19734135p19745537.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Mime
View raw message