having seen many different means of connection pooling in web application most favored one remains context based connection pooling using jndi.In tomcat the dbcp is default connection factory, in many cases you may find connection leaks due to unclosed To configure a DBCP DataSource so that abandoned dB connections are removed and recycled the following attribute should be added to the Resource configuration of your DBCP DataSource:
removeAbandoned="true"
removeAbandonedTimeout attribute will set the number of seconds a dB connection has been idle before it is considered abandoned.
removeAbandonedTimeout ="120"
The same is also applicable to non web application. any standard connection pooling solution will support maxwait, maxactive, maxidle,removeAbandoned ,removeAbandonedTimeout this can help in efficient handling of connections and resources
Hibernate configuration for connection pooling with c3p0.
hibernate.c3p0.max_size=20
hibernate.c3p0.max_statements=0
hibernate c3p0.min_size=10
hibernate c3p0.timeout=120
Hibernate configuration for connection pooling with DBCP
hibernate.dbcp.maxActive=20
hibernate.dbcp.maxIdle=10
hibernate.dbcp.maxWait=120
hibernate.dbcp.removeAbandoned=true
hibernate.dbcp.removeAbandonedTimeout=60
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment