performance of accounts-daemon is very poor
Submitted by Vadim Rutkovsky
Assigned to Matthias Clasen
Original report: https://bugs.launchpad.net/bugs/941673
The performance of accounts-daemon is unacceptable with large password and/or group files. We have appoximately 40000 users in the passwords file and 16000 lines in the group file. Having looked at the source, it appears to me the problem is that for each user is pulls from the password database (via getpwXXX) its then calls getgrouplist to return the users list of groups.
Getgroups must make a complete pass through the group file to determine the groups for the user. When initializing this results in reading the groups file 40000 times.
I think a better solution is to build a inverted group file map then first time getgroups is called by reading the entire group database and building a data structure indexed by username where a users group list can by found in a single lookup. Of couse, an even better solution would be for getgroups to do that itself, but that would require much larger code changes.
I tried installed nscd to see if this would make a difference but no dice.