Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Connection pool management

I'm developing a high load web service that would provide as fast response as possible. The service should keep a bunch of connections to various databases for faster performance. I'm suggesting using connection pool for that. There may be connection problems to DB because we have a lot of remote access to the DB through VPN. As I have said, service should retain connection as long as possible.

What is the connection pool management algorithm?

I have a connection string: Code:

User Id=inet;Password=somePassw0rd;Data Source=TEST11;Min Pool Size=5;Max Pool Size=15;Pooling=True

Then I simply open and close connection in my code. That's it.

At this moment everything is OK. There are five sessions on DB side. So I would kill a session to simulate connection problems. And in some cases the connection will be restored by pool manager and in some cases it won't.

If I kill all five connections they are never restored back.

How can I confiure pooling manager? Any settings for duration between checking DB connections?

I have used validate connection=true; it seems to work fine for me, but it would need some effort if reconnect to DB is needed, and therefore it would be more efficient to have an already good connection.

The component I used is devArt dotConnect for Oracle. Thanks in advance!

like image 460
kseen Avatar asked Oct 07 '11 03:10

kseen


People also ask

What does connection pooling do?

Connection pooling is a technique of creating and managing a pool of connections that are ready for use by any thread that needs them. Connection pooling can greatly increase the performance of your Java application, while reducing overall resource usage.

How do you implement a connection pool?

Let's have a look at below steps to initialize connection pool: Create an instance of ConnectionFactory using JDBC URL. Create an instance of PoolableConnectionFactory using an instance of ConnectionFactory which was created in step 1.

How do I monitor connection pooling?

Select the Connection Pooling tab. Ensure that the PerfMon Enable checkbox is checked. Start Performance Monitor by selecting Start → All Programs → Administrative Tools → Performance.

What happens when connection pool is full?

If the maximum pool size has been reached and no usable connection is available, the request is queued. The pooler then tries to reclaim any connections until the time-out is reached (the default is 15 seconds). If the pooler cannot satisfy the request before the connection times out, an exception is thrown.


1 Answers

I'm not sure what you're exactly looking after, but this can be useful: pools are automatically cleared if a connection is idle for some time or closed by the server. However you can force pool clearance, using OracleConnection's ClearPool or ClearAllPools methods (these methods usually exist on most ADO.NET providers, also it's not a requirement).

Note that if you're using Oracle 11g, DotConnect also supports Oracle's Database Resident Connection Pooling (DRCP) which is presumably the best way to do pooling, since it's provided by Oracle itself (I don't have any experience on this though).

like image 128
Simon Mourier Avatar answered Oct 19 '22 12:10

Simon Mourier