commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sandy McArthur" <sandy...@apache.org>
Subject [pool][dbcp] trimming the pool size after load spikes
Date Wed, 01 Nov 2006 01:14:43 GMT
Phil and others interested in Pool and DBCP,

While working on resolving POOL-86 which is about finding a way to
trim the pool size down after a load spike to try to minimize used
resources during off peak load levels.

I've suggested a decorator that wraps a pool and monitors it's usage
and intercepts calls to returnObject and directs them to
invalidateObject occasionally in order to shrink the size of the idle
objects in the pool.

I think this is a good idea because it solves the deadlock issue
described in DBCP-65 when DBCP uses an evictor.

The most crude form of the decorator would implement returnObject
something like:

returnObject(Object obj) {
  if (Math.random() < 0.01) { // 1% of the time
    wrappedPool.invalidateObject(obj);
  } else {
    wrappedPool.returnObject(obj);
  }
}

more intelligent code could take in to account the actual number if
active and idle pooled objects. Hopefully that conveys the idea I'm
thinking of.

This does have flaws in that it does require activity on the pool for
it to work because it wouldn't have it's own thread, but that is also
how it avoids the risk of deadlocks.

Anyone agree or disagree with me that this is a worthy feature.

More info at:
http://issues.apache.org/jira/browse/DBCP-65
http://issues.apache.org/jira/browse/POOL-86

-- 
Sandy McArthur

"He who dares not offend cannot be honest."
- Thomas Paine

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message