Uma, Do you make a new pool for every request? That takes up a lot of resources. Are you positive you are shutting down the pool and the connection when you are done with them? Ideally, you setup your pool once, store it in serlet or application context, then use that on instance to hand you off a "connection" and release that connection when you are done so it can be reused. That optimizes connection use and setup time. From your below code snippet and example, it feels like you are creating a pool in every request so it takes time to talk to the database and open the connection. Then, you get a connection and have to close it AND the pool down or it eats up memory and could invoke memory swapping related slowdown (if used in production or in a stress test). Again, that is the impression from the few lines of code below.
Regards, David -----Original Message----- From: Kalluru Uma. Maheswar [mailto:[EMAIL PROTECTED] Sent: Wednesday, January 19, 2005 5:22 AM To: Struts Users Mailing List Subject: Connection Pool best practice Hi, I am using org.apache.commons.dbcp.BasicDataSource to implement a connection pooling and this is my class. import javax.sql.DataSource; import org.apache.commons.dbcp.BasicDataSource; public class DBPool { public DataSource getDataSource() { BasicDataSource ds = new BasicDataSource(); ds.setDriverClassName("driver"); ds.setUsername("user"); ds.setPassword("pwd"); ds.setUrl("url"); ds.setMaxActive(10); ds.setMaxWait(5000); return ds; } } And in the classes where I need database connection, I am saying DBPool dbPool = new DBPool(); dbPool.getDataSource(); By doing this, my application is getting slower. Initially I configured db connection in the struts-config.xml file and it was working fast at that time. Any ways for me to improve the performance and speed? Uma --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]