firstyear / 389-ds-base

Forked from 389-ds-base 4 years ago

d98699a Ticket 50786 - connection table freelist

Authored and Committed by firstyear 2 years ago
    Ticket 50786 - connection table freelist
    Bug Description: The connection table previously to find an available
    slot would iterate over the table attempting to find a free connection.
    Under high congestion this yields poor performance as we may need to walk
    O(n) slots to find the "one free", and the algorithm allowed the table to
    be walked twice, making it potentially a O(2n) worst case. To make this
    worse, the walking attempted to "trylock" - better than before (which
    really locked!), but the trylock still issues atomics that are costly.
    Fix Description: Implement a freelist - at start up all connections are
    free, and as they are allocated they are removed from the list. As they
    are disconnected they are re-added. This makes the lookup of a connection
    O(1), removes spurious atomic and locking behaviour, and helps to minimise
    time under the conntable lock. In some test cases this is shown to
    improve server throughput by at minimum 6%
    Author: William Brown <>
    Review by: tbordaz, lkrispen
file modified
+147 -36
file modified
+4 -0