Details
-
Task
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
None
-
None
Description
When the async pool is exhausted, acquire() waits on an asyncio.Condition
and release() appends the connection to the free list and calls notify().
Between the notify and the waiter's turn, a newer acquire() can take that
connection, so the waiter wakes up, finds nothing and waits again: under
500-way contention about half the wake-ups were wasted (2880 waits for
1500 acquires). release() also took the lock three times per call.
Replace the condition with a FIFO deque of waiter futures.