mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-31 14:35:26 +00:00
Qpzone employs a locking strategy where rwlocks are grouped into buckets, and each zone gets 17 buckets. This strategy is suboptimal in two ways: - If named is serving a single zone or a zone is the majority of the traffic, this strategy pretty much guarantees contention when using more than a dozen threads. - If named is serving many small zones, it causes substantial memory usage. This commit switches the locking to a global table initialized at start time. This should have three effects: - Performance should improve in the single zone case, since now we are selecting from a bigger pool of locks. - Memory consumption should go down significantly in the many zone cases. - Performance should not degrade substantially in the many zone cases. The reason for this is that, while we could have substantially more zones than locks, we can query/edit only O(num threads) at the same time. So by making the global table much bigger than the expected number of threads, we can limit contention.