Uploaded image for project: 'Commons Pool'
  1. Commons Pool
  2. POOL-165

idle object eviction-too coarse grained locking

    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.5.5
    • None

    Description

      From GenericKeyedObjectPoolFactory's javadoc:
      "Optionally, one may configure the pool to examine and possibly evict objects as they sit idle in the pool and to ensure that a minimum number of idle objects is maintained for each key. This is performed by an "idle object eviction" thread, which runs asynchronously. Caution should be used when configuring this optional feature. Eviction runs require an exclusive synchronization lock on the pool, so if they run too frequently and / or incur excessive latency when creating, destroying or validating object instances, performance issues may result. The idle object eviction thread may be configured using the following attributes.."

      This can be improved im the following manner:

      • use an lock per object rather than per pool. Whenever borrowing an object acquire a write lock for the time object is borrowed
      • the "idle object eviction" will check if the object is locked and if so ignore it - this is a best effort approach that should satisfy most of the scenarios. Otherwise acquire a lock on it, and it won't be available for clients.
        Glad to help on this one!

      Attachments

        Activity

          People

            Unassigned Unassigned
            mircea.markus Mircea Markus
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: