Skip to content

WIP: winbind: getpwent rewrite to reduce queries

aaronhaslett requested to merge samba-team/devel/samba:aaron-samr-perf-2 into master

The current getpwent is too slow on large databases (>50k), especially if most users don't have entries in the samlogoncache. The runtime is mostly expended by doing lots of per-user queries instead of using the batching abilities of modules like sids2xids, and with GUID lookups in the source4 samr RPC server. This is a rewrite of winbindd_getpwent which leverages list_users and list_groups, and batches the sids2xids lookups to eliminate unnecessary queries.

Here's some timing results for "time getent passwd" taken on a 50k database of users with no samlogoncache entry. This MR is for the "winbind fix", the "rpc fix" is for the GUID lookups in the source4 RPC server and is in a separate MR (728).

master: 60s, 36.02s, 35.65s, 36.15s, 36.77s
master + rpc fix: 34.63s, 14.36s, 14.62s, 14.71s, 14.29s
master + winbind fix: 35.18s, 23.97s, 25.56s, 25.10s, 24.76s
master + rpc fix + winbind fix: 2.18s, 9.149s, 2.5s, 2.462s, 2.459s

Edited by Andrew Bartlett

Merge request reports