Tuesday, December 1, 2009

Database Connection Pooling

Database Connection pooling should be the first taken for performance optimization. C3PO offers connection pooling most used in Java projects. There are some properties which are basic like minPoolSize and maxPoolSize. minPoolSize Should be atleast equal to number of concurrent requests you foresee on your website. maxPoolSize, maxIdleTimeExcessConnections, acquireIncrement can be used to for handelling exceptional overload on server.

maxIdleTimeExcessConnections can be set to 5 minutes. It will bring back active connections to minPoolSize from maxPoolSize if it is idle.

maxStatements and maxStatementsPerConnection are used to save compilation time every time u call prepareCall. But it dont help. Keep both 0. If you set maxStatements as lets say 50 and if the size is consumed by current request there may be bottlenecks and Spikes. So avoid it.For maxStatements, It doesnt make sense compiling statements in application server because there may be 1000s of SQLs in your application.

1 comment: