Browse Prior Art Database

Autonomic, Scalable, and Memory Minimizing Object Pool Disclosure Number: IPCOM000124897D
Original Publication Date: 2005-May-11
Included in the Prior Art Database: 2005-May-11
Document File: 3 page(s) / 25K

Publishing Venue



Disclosed is a technique for a highly scalable and memory minimizing object pool that performs well in complex environments.

This text was extracted from a PDF file.
This is the abbreviated version, containing approximately 35% of the total text.

Page 1 of 3

Autonomic, Scalable, and Memory Minimizing Object Pool


The problem addressed by this object pooling technique is that of how to create an autonomic high performance object pool. The object pool should be able to be scalable to high levels of concurrency while minimizing the amount of total memory consumed, epically by unnecessary objects that may never be used. Most current solutions for object pooling rely on creating a single global collection of objects. This solution does a great job of minimizing (or at least can very easily minimize) the amount of "wasted" memory by a variety of methods such as simply setting a maximum size to keep around. The draw back to this design is the global collection must be guarded by some sort of synchronization in order to protect against concurrent access, so this sort of a design is horrible in scalability to high levels of concurrency. Other solutions have attempted to solve this lack of scalability through a variety of methods usually involving pooling on a thread-local basis, but they all end up "wasting" more memory in order to do so, epically in complex scenarios such as when difference threads need varying levels of objects. Some of these other solutions will flat out fail to realize any pooling benefit in certain situations such as if the pool gets are done on one thread and the pool puts are done on another thread.

The algorithm

This technique starts off with creating a global pool. This will be synchronized and be accessible by all threads. This global pool will also have a max size such that only N items may exist in it at any given time. As objects are inserted into the pool, a timestamp on the object is set to the current time that the object is inserted into the pool. This global pool will have a timeout mechanism such that objects in the pool do not reside there for long periods of time. After an object times out, its memory is freed. This global object pool will also be a last in first out pool as to minimize system memory and processor cache strain. The last in object will be the most likely object to still be in memory or processor cache so we will return it before any other object. This global-pool should also implement a batch get and put such that multiple objects can be put or got with only obtaining the lock guarding the global pool once.

As threads are created and an attempt to get an object contained in the pool, an additional pool will be created and stored in thread local storage. This additional pool will only be lazily created when the thread first accesses the pool as to minimize memory consumption by the pool. This thread-local pool will be unsynchronized since it will only be accessible by the thread itself. This thread-local pool will have a max size such that no more than n items will exist in it at any given time. This thread-local pool will also be a last in first out pool in order to minimize system memory and processor cache strain just as in the...