Database Connection Pooling

 Friends in software engineering, a connection pool is a cache of database connections maintained so that the connections can be reused when future requests to the database are required.

There are various types of Connection pooling. which are listed below.

1. DBCP2 Connection pooling

https://commons.apache.org/proper/commons-dbcp/

2. BoneCP

http://jolbox.com/

3. HikariCP

http://brettwooldridge.github.io/HikariCP/

4. C3PO

http://www.mchange.com/projects/c3p0/

By Default Hibernate uses a C3P0 Connection pooling for creating connections. From performance point of view HikariCP is best as it can handle large number of concurrent connections. while BoneCP is alternative to C3PO & provide following good features

  • Highly scalable, fast connection pool
  • Callback (hook interceptor) mechanisms on a change of connection state.
  • Partitioning capability to increase performance
  • Allows direct access to a connection/statements
  • Automatic resizing of pool
  • Statement caching support
  • Support for obtaining a connection asynchronously (by returning a Future<Connection>)
  • Release helper threads to release a connection/statement in an asynchronous fashion for higher performance.
  • Easy mechanism to execute a custom statement on each newly obtained connection (initSQL).
  • Support to switch to a new database at runtime without shutting down an application
  • Ability to replay any failed transaction automatically (for the case where database/network goes down etc)
  • JMX support
  • Lazy initialization capable
  • Support for XML/property configuration
  • Idle connection timeouts / max connection age support
  • Automatic validation of connections (keep-alives etc)
  • Allow obtaining of new connections via a datasource rather than via a Driver
  • Datasource/Hibernate support capable
  • Debugging hooks to highlight the exact place where a connection was obtained but not closed
  • Debugging support to show stack locations of connections that were closed twice.
  • Custom pool name support.
  • Clean organised code. 100% unit test branch code coverage (over 180 JUnit tests).
  • Free, open source and written in 100% pure Java with complete Javadocs.
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s