You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Phil Steitz <ph...@gmail.com> on 2008/01/04 03:47:23 UTC

[pool] 1.2, 1.4-RC1 maxActive can be exceeded by one

Load tests using sandbox/performance with the config below picked up
(number of makes - number of destroys) = maxActive + 1 under both pool
1.2 and 1.4-RC1.  What is going on is that the config enables the idle
object evictor and sets minIdle > 0 and makes the "evictor" run
frequently.  When it runs, it often has to create idle instances.  It
is correctly gating the number created using calculateDeficit, but
when addObject initiates a makeObject, it does not increment numActive
before the make.  This allows a borrowObject to jump in, increment the
counter and initiate another make.   Any ideas or patches on how best
to fix this would be appreciated.  My first thought was to increment
numActive in addObject, but that is not correct, since it is actually
numIdle that needs to be incremented and that is read directly from
the pool. It is probably best to add a total instance counter. Then
stick with the pattern increment before make, decrement after destroy.
 This does not apply to GenericKeyedObjectPool, since there
ensureMinIdle is synchronized.  Another solution would be to
synchronize either or both of ensureMinIdle or addObject (as in 1.3,
which passes the test, though with almost 10x slower average
performance).  That could have performance impacts; however, when
makes are expensive.  Ideas / patches (against
branches/1_4_RELEASE_BRANCH) welcome.

<configuration>
  <factory>
    <activate-latency>0</activate-latency>
    <destroy-latency>0</destroy-latency>
    <make-latency>100</make-latency>
    <passivate-latency>0</passivate-latency>
    <validate-latency>50</validate-latency>
    <waiter-latency>100</waiter-latency>
  </factory>
  <pool>
    <!-- GenericObjectPool or AbandonedObjectPool -->
    <type>GenericObjectPool</type>
    <max-active>50</max-active>
    <max-idle>30</max-idle>
    <min-idle>20</min-idle>
    <max-wait>-1</max-wait>
    <!-- block, fail, or grow -->
    <exhausted-action>block</exhausted-action>
    <test-on-borrow>true</test-on-borrow>
    <test-on-return>false</test-on-return>
    <time-between-evictions>5000</time-between-evictions>
    <tests-per-eviction>3</tests-per-eviction>
    <idle-timeout>-1</idle-timeout>
    <test-while-idle>false</test-while-idle>
  </pool>

  <!-- Ignored unless pool type is AbandonedObjectPool -->
  <abandoned-config>
    <log-abandoned>true</log-abandoned>
    <remove-abandoned>true</remove-abandoned>
    <abandoned-timeout>50000</abandoned-timeout>
  </abandoned-config>

  <run>
    <iterations>1000</iterations>
    <clients>50</clients>
    <delay-min>500</delay-min>
    <delay-max>500</delay-max>
    <delay-sigma>50</delay-sigma>
    <!-- constant, gaussian, or poisson -->
    <delay-type>constant</delay-type>
    <!-- none, linear, random -->
    <ramp-type>none</ramp-type>
    <ramp-period>5000</ramp-period>
    <peak-period>2000</peak-period>
    <trough-period>5000</trough-period>
    <!-- none, oscillating (others?)-->
    <cycle-type>none</cycle-type>
  </run>

</configuration>

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


Re: [pool] 1.2, 1.4-RC1 maxActive can be exceeded by one

Posted by Phil Steitz <ph...@gmail.com>.
This issue is being tracked as POOL-120.

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