Questions tagged [connection-pooling]

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

Description

Connection pools are used to enhance the performance of executing commands on a database or other server. Opening and maintaining a connection for each user especially requests made to a dynamic database-driven website application, is costly and wastes resources.

In connection pooling, after a connection is created, it is placed in the pool and it is used over again so that a new connection does not have to be established. If all the connections are being used, a new connection is made and is added to the pool. Connection pooling also cuts down on the amount of time a user must wait to establish a connection to the resource.


Connection Pool libraries

Java

  • HikariCP
    It is considered as one of the best libraries for connection pooling. Play 2.4 Framework uses HikariCP by default.
    Website, GitHub.

  • BoneCP
    It beats older connection pools such as C3P0 and DBCP but should now be considered deprecated in favour of HikariCP.
    Website, GitHub

  • Apache Commons DBCP
    Website.

  • C3P0
    Website, GitHub

3263 questions
30
votes
1 answer

Best approach for returning connection objects to HikariCP pool

I am trying to use HikariCP connection pool. I was able to get it to work and get a connection that I could use. I am not sure what is the best approach for returning the connection to the pool. I have the following questions: Should I close the…
user3813256
30
votes
6 answers

How good is Oracle Universal Connection Pool (UCP)

Does anybody have experience with using Oracle UCP under real production load? Does it handle database reconnects well? Are there any multi-threading issues? Has anybody compared it with C3P0 or Apache DBCP?
30
votes
1 answer

JDBC connection pool runs out of connections when Context reload="true" is enabled in Tomcat

I am developing a Java EE web application in Eclipse Juno. I have configured Tomcat to use JDBC connection pool (org.apache.tomcat.jdbc.pool) along with PostgreSQL database. Here are the configurations in my project's META-INF/context.xml:
informatik01
  • 16,038
  • 10
  • 74
  • 104
29
votes
2 answers

Why does HikariCP recommend fixed size pool for better performance

According to HikariCP's documentation they mentioned to create fixed size pool for better performance. minimumIdle: This property controls the minimum number of idle connections that HikariCP tries to maintain in the pool.If the idle connections…
shivadarshan
  • 896
  • 2
  • 15
  • 25
29
votes
6 answers

What really is connection pooling?

I have heard the term connection pooling and looked for some references by googling it... But can't get the idea when to use it.... When should i consider using connection pooling? What are the advantages and disadvantagesof connection…
bala3569
  • 10,832
  • 28
  • 102
  • 146
29
votes
2 answers

Node.js Redis Connection Pooling

When using node_redis Node.js module with Redis, should I just use one connection as Redis is single thread process or shall I create a pool of connections to improve performance?
Vad
  • 4,052
  • 3
  • 29
  • 34
29
votes
2 answers

Where do I have to place the JDBC driver for Tomcat's connection pool?

So I've figured out my error, now I'm just looking for some insight as to what is going on exactly. I am using Apache Tomcat Version 7.0.32. I am using this tutorial to set up pooling for JDBC. In my META-INF folder I made a context.xml file and put…
gmustudent
  • 2,229
  • 6
  • 31
  • 43
28
votes
4 answers

Configure hibernate to connect to database via JNDI Datasource

Hi all I'm using Hibernate+Struts2+Tomcat6+Mysql as my J2EE framework. I've been using hibernate's built-in connection pooling mechanism but it turned out to be problematic where mysql closes it's connections after 8 hours. Anyway I googled around a…
SJ.Jafari
  • 1,236
  • 8
  • 27
  • 39
28
votes
3 answers

Connection pooling in AWS across lambdas

We know lambdas are charged by the execution time. So now I want to connect to SQL Server DB from lambda. If I create a connection in each lambda, it would be heavy for lambda. Is there any best way to maintain my SQL connections alive in one place…
Learner
  • 1,286
  • 6
  • 34
  • 57
28
votes
2 answers

Apache PoolingHttpClientConnectionManager throwing illegal state exception

Here is how I use it - private static final PoolingHttpClientConnectionManager connPool; static { connPool = new PoolingHttpClientConnectionManager(); // Increase max total connection to 200 …
abipc
  • 997
  • 2
  • 13
  • 35
28
votes
5 answers

Android BLE Connection time interval

I am developing a BLE application on Nexus 4 using Android BLE API. I have a few questions/doubts: 1) Is there a way to set/override the connection or notification interval of BLE central device. I have found that for Android, the default connection…
CoDe
  • 11,056
  • 14
  • 90
  • 197
28
votes
2 answers

How do I implement a DAO manager using JDBC and connection pools?

My problem is as follows. I need a class that works as a single point to a database connection in a web system, so to avoid having one user with two open connections. I need it to be as optimal as possible and it should manage every transaction in…
Carlos Vergara
  • 3,592
  • 4
  • 31
  • 56
27
votes
1 answer

Ideal settings for pgbouncer with Django's CONN_MAX_AGE

I'm running a multi-tennant website, where I would like to reduce the overhead of creating a PostgreSQL connection per request. Django's CONN_MAX_AGE allows this, at the expense of creating a lot of open idle connections to PostgreSQL (8 workers *…
vdboor
  • 21,914
  • 12
  • 83
  • 96
26
votes
4 answers

Thinking behind decision of database connection pool size

i am working on opensource java based application i.e xwiki. Inside hibernate.cfg.xml i can see value of parameters connection.pool_size and statement_cache.size as 2 (for each). My application will be having maximum load of 100 users at point of…
M Sach
  • 33,416
  • 76
  • 221
  • 314
26
votes
1 answer

Updating .NET framework resulting in SQL timeouts

We have an app which targets .NET 4.5.1, and this has remained unchanged. However when we upgraded the .NET framework on the server from 4.5.1 -> 4.7.1, we started experiencing SQL timeouts several hours afterwards (the app target remained at…
FBryant87
  • 4,273
  • 2
  • 44
  • 72