commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Melih Utkan UNSAL <melihut...@yahoo.com>
Subject [DBCP] getting connection from the pool takes long time
Date Sun, 22 Feb 2009 11:55:08 GMT
Hi everybody,

i have a problem with dbcp connection pooling.

configuration is like that;

JAVA  : 1.4.2
library : commons-dbcp-1.2.2.jar ; commons-pool-1.3.jar
DB     : Oracle 9i


datasource is constructed like that;

GenericObjectPool.Config config = new GenericObjectPool.Config();
config.maxActive = -1;
config.minIdle = 50;
config.maxIdle = 10;
config.maxWait = -1;
config.testOnBorrow = true;
config.testOnReturn = true;
config.testWhileIdle = true;
config.whenExhaustedAction = GenericObjectPool.WHEN_EXHAUSTED_GROW;
config.timeBetweenEvictionRunsMillis = -1;
config.minEvictableIdleTimeMillis = -1;
config.softMinEvictableIdleTimeMillis=-1;
config.numTestsPerEvictionRun = -1;

GenericObjectPool connectionPool = new GenericObjectPool(null,config);
ConnectionFactory connectionFactory = new DriverManagerConnectionFactory(systemConnString,
systemUser, systemPassword);
PoolableConnectionFactory
poolableConnectionFactory = new
PoolableConnectionFactory(connectionFactory, connectionPool, null,
PooledConnection.VALIDATEQUERY, false, true);
Class.forName("org.apache.commons.dbcp.PoolingDriver");
PoolingDriver driver = (PoolingDriver) DriverManager.getDriver("jdbc:apache:commons:dbcp:");
driver.registerPool("example", connectionPool);

when i need a connection, i get it like that;

Connection con = DriverManager.getConnection("jdbc:apache:commons:dbcp:example");

when i do not need any more, i just close the connection like that;

con. close


My applicaiton works fine but sometimes, it takes very long time (50000,60000,70000,80000,
90000 MILISECONDS)  getting a connection from the pool. 
(It happens sometimes not always) And because of that ,performance is not acceptable. 

What do you think the problem is?

Thanks in advance


      
Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message