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
23
votes
8 answers

WebApp (Tomcat-jdbc) Pooled DB connection throwing abandon exception

I have been browsing SO for some time, and chewing my hat in the process, but cannot find an exact match to my problem. For short, I am getting superb stack trace (org.apache.tomcat.jdbc.pool.ConnectionPool abandon) after 60 seconds of inactivity,…
MonoThreaded
  • 11,429
  • 12
  • 71
  • 102
23
votes
3 answers

Why doesn't Dapper dot net open and close the connection itself?

Dapper implicitly expects a connection to be open when it uses it. Why doesn't it open and close it itself? Wouldn't this simply connection management? I ask because a co-worker and I have been going back and forth on the nature of what goes on…
smdrager
  • 7,327
  • 6
  • 39
  • 49
22
votes
2 answers

Spring app losing connection to MySql after 8 hours. How to properly configure?

I've got a Spring app that I believe uses DBCP connection pooling to connect to a MySql database. I say believe because this isn't an area I'm very strong in and I'm not positive if everything is set up correctly. I have no problems running the…
cardician
  • 2,451
  • 3
  • 26
  • 36
22
votes
6 answers

Java Database connection pool (BoneCP vs DBPool vs c3p0)

For a Java app outside of a J2EE container, which connection pool library is the best? I heard c3p0 is getting outdated. Jakarta's common pool library is no longer under development Therefore I'm left with BoneCP and DBPool. From what I can tell…
Stephane Grenier
  • 15,527
  • 38
  • 117
  • 192
22
votes
4 answers

What is the maximum and minimum size of connection pool ADO.Net Supports in the connection string?

What is the maximum and minimum size of connection pool ADO.Net Supports in the connection string.Min Pool Size=[max size ?]Max Pool Size=[min size]
Saurabh
  • 5,661
  • 2
  • 26
  • 32
22
votes
2 answers

Failed to validate connection (This connection has been closed.). Possibly consider using a shorter maxLifetime value

I see the following error message: HikariPool-1 - Failed to validate connection org.postgresql.jdbc.PgConnection@f162126 (This connection has been closed.). Possibly consider using a shorter maxLifetime value. frequently refreshing the same page…
22
votes
5 answers

.net connection pooling

I don't get what is the syntax difference between regular connection and connection pool. When I'm using the using key such as: using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); …
Erez
  • 6,405
  • 14
  • 70
  • 124
22
votes
4 answers

How to get detailed list of connections to database in sql server 2005?

How to get detailed list of connections to database in sql server 2005?
21
votes
1 answer

How could I check the number of active sqlalchemy connections in a pool at any given time?

I have a situation where sqlalchemy keeps running out of active connections from time to time due to high traffic loads, and I would like to run some tests to verify and optimize the pooling parameters per our use case. However, I cannot find a…
Priyeshj
  • 1,295
  • 2
  • 17
  • 32
21
votes
1 answer

SQLAlchemy Connection Pool and Sessions

I've recently started using SQLAlchemy and am trying to understand how the connection pool and session work in a web-application I am building an API using flask. __init__.py engine = create_engine('mysql://username:password@localhost/my_database')…
user2268507
21
votes
2 answers

HttpClientError: The target server failed to respond

I am trying to hit a server using HTTP client using PoolingClientConnectionManager setting max connections for individual hosts //Code that initializes my connection manager and HTTP client HttpParams httpParam =…
Balaji V
  • 918
  • 3
  • 10
  • 28
21
votes
1 answer

How does HikariCP handle incomplete JDBC transactions?

Yesterday I came across HikariCP and spent the whole night studying it. I'm really impressed with the amount of detail and effort put into fine tuning its implementation and design. Straight to the point, I could not determine how it actually deals…
Hamid Nazari
  • 506
  • 1
  • 6
  • 18
21
votes
2 answers

Why we need a connection pooling for JDBC?

What are the benefits of using a JDBC connection pooling tool like DBCP or c3p0 ? in case of a small CRUD application with one user, can we just create one connection session as a singleton ? PS: I'm building a small javafx application back-ended…
Salah Eddine Taouririt
  • 24,925
  • 20
  • 60
  • 96
19
votes
6 answers

php connection pooling mysql

I am planning to use MYSQL. Is there a connection pooling extension available? Or what is the normal practice for connection? Is this the one used in every where... mysqli_connect("localhost", "xxx", "xxx", "test"); Do people use just normal…
coool
  • 8,085
  • 12
  • 60
  • 80
19
votes
2 answers

Tomcat JDBC Connection Pool: testOnBorrow vs testWhileIdle

For various reasons connections in a pool can become invalid: server connection timeout, network issues... My understanding is that a Tomcat JDBC Connection Pool does not provide any guaranty about the validity of the connections it provides to the…
Antoine Mottier
  • 1,185
  • 1
  • 8
  • 13