commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ITAGAKI Takahiro <>
Subject Problem on DBCP with exhausted pool
Date Wed, 24 Oct 2007 06:33:48 GMT

I found DBCP does not work well when the connection pool is exhausted:

  1. There are many context switches in the server.
  2. Client-to-client response times are not stable.

If the issues are fiexed, we can use DBCP as a better connection multiplexer
(i.e, server threads > max database connections).

As far as I can see, their cause is same; the combination of wait() and
notifyAll() is used for the thread management in pool.impl.GenericObjectPool.
When the connection pool is exhausted and a connection is freed, all of
waiters are waken up. One of the threads will win the race, and other threads
will sleep again. It's the reason of 1. At the same time, we cannot control
the order of threads acquiring the free connection. FIFO ordering is needed
to tackle with 2.

Is it possible to replace wait-and-notifyAll to waking-up one-by-one
and FIFO ordering? For example, to use ReentrantLock(fair=true).
If I'll try to fix the issues, which class should I change?
I only need the connection pool used in DBCP, but GenericObjectPool
might affect other modules.

Comments and advices welcome.

ITAGAKI Takahiro
NTT Open Source Software Center

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message