keypool icon indicating copy to clipboard operation
keypool copied to clipboard

Implement fairness

Open rossabaker opened this issue 1 year ago • 1 comments

commons-pool2 functionality

In commons-pool2, fairness determines whether requests are serviced in FIFO or LIFO order. The default is LIFO.

Current behavior

keypool only supports FIFO.

Analysis

This is a configuration for good reason. A nice visualization of the tradeoffs is in this queueing article.

The semaphore that lurks within Keypool effectively imposes FIFO ordering. Fixing this would effectively require Keypool reimplement some semaphore-like semantics.

Notably, in the feature comparison, keypool stands alone with its FIFO default.

Workarounds

None

rossabaker avatar Jun 26 '24 03:06 rossabaker

One can also imagine a priority queue here, but that would require an enhanced borrow interface that accepted a priority as an argument.

rossabaker avatar Jun 26 '24 03:06 rossabaker