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.
connection-pooling
3,297
questions
361
votes
13
answers
159k
views
How do I manage MongoDB connections in a Node.js web application?
I'm using the node-mongodb-native driver with MongoDB to write a website.
I have some questions about how to manage connections:
Is it enough using only one MongoDB connection for all requests? Are ...
326
votes
15
answers
216k
views
Connection pooling options with JDBC: DBCP vs C3P0 [closed]
What is the best connection pooling library available for Java/JDBC?
I'm considering the 2 main candidates (free / open-source):
Apache DBCP - http://commons.apache.org/dbcp/
C3P0 - http://...
278
votes
4
answers
152k
views
Entity Framework and Connection Pooling
I've recently started to use the Entity Framework 4.0 in my .NET 4.0 application and am curious about a few things relating to pooling.
Connection pooling as I know is managed by the ADO.NET data ...
217
votes
5
answers
108k
views
What is database pooling?
I just wanted to know the concept of database connection pooling and how it is achieved.
189
votes
14
answers
183k
views
Efficient SQL test query or validation query that will work across all (or most) databases
Many database connection pooling libraries provide the ability to test their SQL connections for idleness. For example, the JDBC pooling library c3p0 has a property called preferredTestQuery, which ...
126
votes
13
answers
207k
views
How to establish a connection pool in JDBC?
Can anybody provide examples or links on how to establish a JDBC connection pool?
From searching google I see many different ways of doing this and it is rather confusing.
Ultimately I need the code ...
126
votes
3
answers
109k
views
Closing JDBC Connections in Pool
Our standard code section for using JDBC is...
Connection conn = getConnection(...);
Statement stmt = conn.conn.createStatement (ResultSet.TYPE_SCROLL_INSENSITIVE,
...
90
votes
9
answers
103k
views
Connection pooling in PHP
Is it possible to cache database connections when using PHP like you would in a J2EE container? If so, how?
89
votes
4
answers
75k
views
DBCP - validationQuery for different Databases
I use DBCP pool and I want use testOnBorrow and testOnReturn to test if connection is still valid.
Unfortunately I have to set property validationQuery to make it work.
Question: What value should be ...
89
votes
3
answers
272k
views
Should I set max pool size in database connection string? What happens if I don't?
This is my database connection string. I did not set max pool size until now.
public static string srConnectionString =
"server=localhost;database=mydb;uid=sa;pwd=mypw;";
So ...
73
votes
6
answers
39k
views
.NET best practices for MongoDB connections?
I've been playing with MongoDB recently (It's AMAZINGLY FAST) using the C# driver on GitHub. Everything is working just fine in my little single threaded console app that I'm testing with. I'm able to ...
73
votes
3
answers
37k
views
Is the Session object from Python's Requests library thread safe?
Python's popular Requests library is said to be thread-safe on its home page, but no further details are given. If I call requests.session(), can I then safely pass this object to multiple threads ...
72
votes
4
answers
53k
views
Change the connection pool size for Python's "requests" module when in Threading
(edit: Perhaps I am wrong in what this error means. Is this indicating that the connection pool at my CLIENT is full? or a connection pool at the SERVER is full and this is the error my client is ...
71
votes
4
answers
21k
views
Java JDBC connection pool library choice in 2011/2012?
Which JDBC connection pool library should I use for a new application project (not web application)?
Apache DBCP has enough unresolved issues which are pushed until 2.0 I think.
C3P0 development ...
62
votes
6
answers
34k
views
Celery Worker Database Connection Pooling
I am using Celery standalone (not within Django). I am planning to have one worker task type running on multiple physical machines. The task does the following
Accept an XML document.
Transform it.
...
53
votes
2
answers
10k
views
flask_sqlalchemy `pool_pre_ping` only working sometimes
For testing, I amend the MYSQL (RDS) parameters as follows;
wait_timeout = 40 (default was 28800)
max_allowed_packet = 1GB (max - just to be sure issue not caused by small packets)
net_read_timeout = ...
49
votes
2
answers
29k
views
What does sp_reset_connection do?
sp_reset_connection seems to be called by SQL Server connection pooling, to ensure that connections reused from the pool have most of their settings reset. Does anyone know exactly what it does and ...
49
votes
3
answers
37k
views
What happens to an uncommitted transaction when the connection is closed?
Are they rolled back immediately?
Are they rolled back after some period of time?
Are they left in an uncommitted state?
Is the behavior the same if connection pooling is used and the connections are ...
48
votes
8
answers
64k
views
Optimal number of connections in connection pool
Currently we are using 4 cpu windows box with 8gb RAM with MySQL 5.x installed on same box. We are using Weblogic application server for our application. We are targeting for 200 concurrent users for ...
47
votes
3
answers
63k
views
Hibernate: What is the connection pool and why is the default one unsuitable for production?
I'm very unfamiliar with Hibernate and have just started working on a web app that uses it with a MySQL database. I notice that the community documentation tutorial states:
The built-in Hibernate ...
47
votes
3
answers
43k
views
Why do I constantly see "Resetting dropped connection" when uploading data to my database?
I'm uploading hundreds of millions of items to my database via a REST API from a cloud server on Heroku to a database in AWS EC2. I'm using Python and I am constantly seeing the following INFO log ...
44
votes
6
answers
116k
views
Springs RestTemplate default connection pool
Just wondering if RestTemplate out of the box uses connection pooling or does it simply establish a new connection each time ?
44
votes
4
answers
97k
views
Spring JDBC connection pool best practices
I have a basic Spring JDBC application with a pretty basic configuration:
<bean id="myDataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="...
43
votes
9
answers
74k
views
What is the best solution for database connection pooling in python?
I have developed some custom DAO-like classes to meet some very specialized requirements for my project that is a server-side process that does not run inside any kind of framework.
The solution ...
42
votes
7
answers
37k
views
How to force a SqlConnection to physically close, while using connection pooling?
I understand that if I instantiate a SqlConnection object, I am really grabbing a connection from a connection pool. When I call Open(), it will open the connection. If I call the Close() or Dispose(...
42
votes
3
answers
22k
views
what is the use of the pool option in database.yml
Most widely used options in database.yml are of following :
adapter
encoding
database
pool
username
password
socket
host
port
timeout
I know the use of the most of the above but pool.
So i want to ...
40
votes
2
answers
70k
views
Best configuration of c3p0 [closed]
I'm struggling with a problem facing c3p0 configuration. I posted a question last week
40
votes
2
answers
19k
views
SQLite/C# Connection Pooling and Prepared Statement Confusion
I have been spending some time reading different best practices for databases and for SQLite specifically. While reading I found I was doing many things I shouldn't be doing and when attempting to fix ...
39
votes
7
answers
120k
views
Connection pooling in java using HttpClient [closed]
How can I create a pool of connections using HttpClient?
I have to make frequent connections to the same server. Is it worth creating such a pool?
Is it possible to keep HTTP connections live and use ...
38
votes
3
answers
63k
views
How to Debug / Log Tomcat JDBC Connection Pool's connections?
I am using Tomcat JDBC connection pool along with Spring boot, JDBC template and SQL Server. I need to know what is going inside connection pool while application is waiting for database connection. ...
38
votes
1
answer
62k
views
How Jedis Pool works?
I'm using Jedis pool to manage connections to Redis server. An example code of mine as follows:
public Set<String> getTopArticleList(int start, int end) {
Set<String> list = null;
...
37
votes
1
answer
13k
views
Difference between BasicDatasource and PoolingDatasource
What is the difference between org.apache.commons.dbcp BasicDatasource and PoolingDataSoure? Do both support pooling of connections? When to use each of them ?
37
votes
2
answers
83k
views
Correct way to keep pooled connections alive (or time them out and get fresh ones) during longer inactivity for MySQL, Grails 2 app
I have a grails app that has flurries of high activity, but then often periods of inactivity that can last several hours to over night. I notice that the first users in the morning get the following ...
36
votes
2
answers
59k
views
How does pgBouncer help to speed up Django
I have some management commands that are based on gevent. Since my management command makes thousands to requests, I can turn all socket calls into non-blocking calls using Gevent. This really speeds ...
36
votes
2
answers
28k
views
How rails database connection pool works
I am learning rails database connection pool concept. In rails application I have defined pool size of 5.
my understanding about connection pool size is as below.
When server start rails ...
34
votes
6
answers
40k
views
How to set application_name for postgres connections?
I'm using tomcat connection pool org.apache.tomcat.jdbc.pool.DataSource. The connections appear in my database pg_stat_activity with empty application_name.
How could I set that application name in ...
34
votes
6
answers
30k
views
How to detect SqlServer connection leaks in a ASP.net applications?
I'm currently doing some GUI testing on a ASP.net 2.0 application.
The RDBMS is SQL Server 2005. The host is Win Server 2003 / IIS 6.0.
I do not have the source code of the application because it ...
34
votes
1
answer
3k
views
Threading error when using `ActiveRecord with_connection do` & ActionController::Live
Major edit: Since originally finding this issue I have whittled it down to the below. I think this is now a marginally more precise description of the problem. Comments on the OP may therefore not ...
33
votes
10
answers
101k
views
Need Code to create Connection Pool in java
Need code to create the connection pool in java?
How does we make sure that connection pool doesn't return the same object which is already in use?
How happens if client closed the connection after ...
33
votes
4
answers
38k
views
Am I Using JDBC Connection Pooling?
I am trying to determine if I am actually using JDBC connection pooling. After doing some research, the implementation almost seems too easy. Easier than a regular connection in fact so i'd like to ...
33
votes
2
answers
58k
views
hibernate connection pool
I can't seem to get hibernate to use c3p0 for connection pooling, it says
12:30:35,038 INFO DriverManagerConnectionProvider:64 - Using Hibernate built-in connection pool (not for production use!)
12:...
33
votes
2
answers
10k
views
“error: 19 - Physical connection is not usable” with OWIN access in Azure database
I have tried all the other postings on the dreaded "error 19" and found that the few with answers do not apply or do not help, hence this new post. This is a very serious potential problem for all ...
32
votes
6
answers
65k
views
Is there any way to have the JBoss connection pool reconnect to Oracle when connections go bad?
We have our JBoss and Oracle on separate servers. The connections seem to be dropped and is causing issues with JBoss. How can I have the JBoss reconnect to Oracle if the connection is bad while we ...
32
votes
1
answer
31k
views
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 ...
32
votes
3
answers
28k
views
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 ...
32
votes
2
answers
37k
views
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 ...
31
votes
2
answers
65k
views
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 ...
31
votes
4
answers
83k
views
JDBC Connection pooling using C3P0
Following is my helper class to get DB connection:
I've used the C3P0 connection pooling as described here.
public class DBConnection {
private static DataSource dataSource;
private static ...
30
votes
6
answers
34k
views
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 ...
30
votes
2
answers
20k
views
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?