[jboss-user] [Datasource Configuration] New message: "Re: Problem with number of database connections (Oracle)"

Adrian Brock do-not-reply at jboss.com
Tue Jan 12 12:52:25 EST 2010


User development,

A new message was posted in the thread "Problem with number of database connections (Oracle)":

http://community.jboss.org/message/519635#519635

Author  : Adrian Brock
Profile : http://community.jboss.org/people/adrian@jboss.org

Message:
--------------------------------------------------------------
> michal_rorat wrote:
>  
> You might think that with this configuration after starting JBoss you will have 5 connections made to DB but I have 38! Even when I set max-pool-size in oracle-ds.xml to 5 it don't change the number of created connections which I get from Oracle Enterprise Manager.
>  
> If I put for example 5 in min-pool-size the numer of connection created is 43.

43-5=38
 
5 is the number of connections that get created when you first use the datasource, if you specify a min-pool-size of 5.
 
Since that number matches the difference in configuration that suggests to me that there were none in the pool before the change.
> 
>  
> Sub Pool Statistics:
> Sub Pool Count: 1
> ---------------------------------
>  
> Track By Transaction: true
> Available Connections Count: 60
> Max Connections In Use Count:1
> Connections Destroyed Count:2
> Connections In Use Count:0
> Total Block Time:0
> Average Block Time For Sub Pool:0 
> Maximum Wait Time For Sub Pool:0
> Total Timed Out:2
>  
> -----------------------------------------------------------------------------------------
>  
 
Can you look on the MBean itself at the attributes. There should be a one called "ConnectionsCreatedCount".
Once you find it, substract the "ConnectionsDestroyedCount" (which we know was 2 and they both timed out).
 
I don't know why the created count is not shown in listStatistics? You might want to report it as a bug?
> And 5 MDBs with one connection reserved for each of them
 
When you say 5 MDBs, do you mean one EJB deployment with 5 JMS Sessions in the pool
or do mean 5 EJBs with 15 (the default)?
 
If the latter, then each MDB instance has a DB connection, that could reach 5 x 15 = 75 connections if all the sessions/instances get used.
This is probably what you are seeing?
 
What numbers do you get if you don't deploy the MDB(s)?
 
P.S. Holding an unshared resource in an EJB instance is an anti-pattern. It doesn't scale (see the calculation above).
P.S.2. It can also lead to problems if your MDB throws a RuntimeException or Error, since them the instance is thrown away
and a new one created without the destroy lifecycle getting invoked.
So you have no opportunity to close() the resource - it won't get cleaned up until garbage collection spots it (assuming it has a finalize method).

--------------------------------------------------------------

To reply to this message visit the message page: http://community.jboss.org/message/519635#519635




More information about the jboss-user mailing list