[Pkg-shadow-devel] slow useradd -r on LDAP box

Nicolas François nicolas.francois at centraliens.net
Tue Jul 14 11:16:12 UTC 2009


Hi Peter,


Sorry for the delay.

On Wed, Jul 01, 2009 at 12:08:25PM +0200, pvrabec at redhat.com wrote:
> Dear upstream,
> 
> we both know that useradd -r (or useradd) is slow(~minutes) on box with LDAP 
> accounts. Useradd -r is special case, because it is used by package system, So 
> when you want to install your favourite daemon you have to wait a long time 
> which is annoying.
> 
> I'd like to discuss  possibility of changing alg. of find_new_uid/gid little 
> bit. What if we use getpwuid() to find free SYSTEM UIDs!. Calling getpwuid() 
> max 1000 times takes almost same time as getpwent() on the box without LDAP 
> but significantly less than getpwent() on box with LDAP with 10000 users. 
> 
> What do you think?

Yes, that could be a solution to fix this issue.

It's still strange to me that getpwent() is so slow. But this should fix
the handling of system users.
For regular users, it would be nice to find a solution, and it might be
worth trying if the above solution could not be applied also.

> I would also like to ask if you agree with current implementation of system 
> uid look up. In case of user accounts we look for 
> * first max free UID. 
> In case of system accounts we look for 
> * first free UID in reverse order. 
> Should we look for 
> * first min free UID in reverse order?

That could be more logical, and could reduce the reuse of system IDs.
That's probably a less urgent issue since current user probably still have
system IDs creted with the previous algorithm.

-- 
Nekral



More information about the Pkg-shadow-devel mailing list