activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From vishva <vishva2...@gmail.com>
Subject Active MQ performance tuning
Date Tue, 01 Mar 2016 20:21:28 GMT
Hi,
I have configured activemq on one of my servers. Whenever my Apache- Tomee
server 1.7.2 receives a request, i make a call to activemq to poll for an
object. I am getting around 500 calls per second. When I start my server, I
start getting following exception in around 1 hr.

javax.jms.JMSException: No ManagedConnections available within configured
blocking timeout ( 5000 [ms] ) for pool
org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor@24eea7aa

Caused by: javax.jms.JMSException: No ManagedConnections available within
configured blocking timeout ( 5000 [ms] ) for pool
org.apache.geronimo.connector.outbound.SinglePoolConnectionInterceptor@24eea7aa
	at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:101)
	at
org.apache.activemq.ra.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:67)
	at
com.walkin.utils.JMSQueueUtils.retrieveObjectFromQueue(JMSQueueUtils.java:50)
	... 82 more

I believe error is because activemq is trying to get hold of a connection
and connection is not present in the pool.
I have the following configuration in my resource.xml

<Resource id="MyJmsResourceAdapter" type="ActiveMQResourceAdapter">
        BrokerXmlConfig = 
        ServerUrl       =
tcp://localhost:61616?jms.prefetchPolicy.queuePrefetch=50
    </Resource>
 
    <Resource id="myJmsConnectionFactory"
type="javax.jms.ConnectionFactory">
		connectionMaxIdleTime = 15 Minutes
	    connectionMaxWaitTime = 25 seconds
	    poolMaxSize = 60
	    poolMinSize = 0
	    resourceAdapter = MyJmsResourceAdapter
	    transactionSupport = xa
	</Resource>

The code that gets called on each server request is the following

private static <T> T retrieveObjectFromQueue(Queue queue, Class<T> clazz,
boolean indefiniteWait) {
		Connection conn = null;
		Session session = null;
		try {
//GlobalConfiguration.getJMSConnectionFactory() has only one instance of
connection factory, and that gets
// returned through out
			conn = GlobalConfiguration.getJMSConnectionFactory().createConnection();
			conn.start();
			session = conn.createSession(false, Session.CLIENT_ACKNOWLEDGE);
			MessageConsumer consumer = session.createConsumer(queue);
			ObjectMessage obj = null;
			if(indefiniteWait)
				obj = (ObjectMessage) consumer.receive();
			else
				obj = (ObjectMessage) consumer.receive(10000);
			consumer.close();
			if(obj == null)
				return null;
			obj.acknowledge();
			return clazz.cast(obj.getObject());
		} catch (Exception e) {
			throw new RuntimeException(e);
		} finally {
                       session.close();
                       conn.close();
		}
	}

I believe since in my configuration, i have specified using a connection
factory with pool size of 60, create connection call should not be creating
connection on each function call, and it must be getting used from the pool.

Is the only soln. to handle this is to increase the pool size ?? If yes,
then if the request size increases to 10k requests per sec, then i will have
to increase pool size accordingly ?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Active-MQ-performance-tuning-tp4708778.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Mime
View raw message