chrisvest / stormpot

A fast object pool for the JVM
http://chrisvest.github.io/stormpot/
Apache License 2.0
357 stars 42 forks source link

How do I avoid the disregardPile queue from getting longer? #154

Closed JiZhihan closed 7 months ago

JiZhihan commented 7 months ago

How can I prevent the disregardPile queue from growing longer over time? After the service starts for a period of time, the length of disregardPile will increase, and the number of live objects will decrease, causing a shortage of objects in the pool.

image

What is the reason for this, and I don't understand the significance of the disregardPile queue.

chrisvest commented 7 months ago

Objects in the live queue might be in the TLR_CLAIMED state. We cannot claim those. To get blocking behavior out of the queue, it must be empty. So we temporarily put the TLR_CLAIMED objects in the diregardPile. If we block on the live queue for a 100 millisecond wait quantum, without getting a useable object, then we refill the live queue with our disregarded objects and check them again. The 100 milliseconds is not tunable, unfortunately.

JiZhihan commented 7 months ago

Thank you for your answer