You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by Javier Leyba <xl...@gmail.com> on 2007/01/10 13:04:13 UTC

jdbc persistence limit ?

Hi

My application defines a broker with a MySQL jdbcPersistenceAdapter
and use durable topics.

I'm trying to make load test so I did a client that simulates 100
clients subscribed to a topic and received the following error:

----------------
Data source rejected establishment of connection,  message from
server: "Too many connections"
	at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:46)
	at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1177)
	at org.apache.activemq.ActiveMQSession.syncSendPacket(ActiveMQSession.java:1661)
	at org.apache.activemq.ActiveMQMessageConsumer.<init>(ActiveMQMessageConsumer.java:197)
	at org.apache.activemq.ActiveMQTopicSubscriber.<init>(ActiveMQTopicSubscriber.java:118)
	at org.apache.activemq.ActiveMQSession.createDurableSubscriber(ActiveMQSession.java:1070)
	at org.apache.activemq.ActiveMQSession.createDurableSubscriber(ActiveMQSession.java:1012)
	at com.bs.tester.Worker.run(Worker.java:98)
------------------

After a little investigation I discovered my datasource refer to JBoss
pool with 20 max connections and my client connected 20 first
subscribers but rejected with the above error next 80.

Now I wonder to know if it is what I think it is: activemq broker open
a DB connection for each subscriber ?


Thanks in advance


-- 
Javier Leyba
Barcelona - Spain
http://blog.leyba.com.ar

Re: jdbc persistence limit ?

Posted by James Strachan <ja...@gmail.com>.
On 1/10/07, Javier Leyba <xl...@gmail.com> wrote:
> Hi
>
> My application defines a broker with a MySQL jdbcPersistenceAdapter
> and use durable topics.
>
> I'm trying to make load test so I did a client that simulates 100
> clients subscribed to a topic and received the following error:
>
> ----------------
> Data source rejected establishment of connection,  message from
> server: "Too many connections"
>         at org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:46)
>         at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnection.java:1177)
>         at org.apache.activemq.ActiveMQSession.syncSendPacket(ActiveMQSession.java:1661)
>         at org.apache.activemq.ActiveMQMessageConsumer.<init>(ActiveMQMessageConsumer.java:197)
>         at org.apache.activemq.ActiveMQTopicSubscriber.<init>(ActiveMQTopicSubscriber.java:118)
>         at org.apache.activemq.ActiveMQSession.createDurableSubscriber(ActiveMQSession.java:1070)
>         at org.apache.activemq.ActiveMQSession.createDurableSubscriber(ActiveMQSession.java:1012)
>         at com.bs.tester.Worker.run(Worker.java:98)
> ------------------
>
> After a little investigation I discovered my datasource refer to JBoss
> pool with 20 max connections and my client connected 20 first
> subscribers but rejected with the above error next 80.
>
> Now I wonder to know if it is what I think it is: activemq broker open
> a DB connection for each subscriber ?

Firstly ActiveMQ uses the DataSource implementation you give it, so
its pooling JDBC connections for sure.  ActiveMQ is also highly
concurrent - each thread processing each JMS connection will at some
point attempt to get and use a JDBC connection. However any half
decent JDBC pool should just block if you've used up your maximum
connections rather than barfing.

e.g. if you've only 20 connections and 80 threads trying to use them -
just let those 60 block until the 20 have done with 'em.

You could try switching pooling provider to c3po or dbcp or something.

-- 

James
-------
http://radio.weblogs.com/0112098/