On Oct 5, 2006, at 10:05 PM, Kjetil Torgrim Homme wrote:
On Thu, 2006-10-05 at 16:46 -0400, Chaskiel M Grundman wrote:
mynewstate is taking 8s to run, and very little of the time is
taken up in
local subroutines.
auth_unix.c:mynewstate calls getpwnam, and then iterates over all the
groups using getgrent(),
checking to see what groups the user is in. The fact that imapd
does this
twice might be a bug, but even if it didn't do it twice, it would
still be
slow.
to speed up initgroups, make sure you have the netid.byname NIS
map. if
you're not familiar with it, the keys should be "unix.UID@NISDOMAIN",
the values are "UID:GID,GID,GID,...". an example for my account,
which
is uid 1232 in domain "ifi":
key: "unix.1232@ifi"
value: "1232:0,6,15,7411,11232"
presto, no iteration through the complete group map needed!
Unfortunately, in the cyrus implementation (they don't call the
"real" initgroups() specifically), they're iterating through the
group map entry by entry... The (somewhat mysterious) netid map
isn't going to help :(
-rob
----
Cyrus Home Page: http://cyrusimap.web.cmu.edu/
Cyrus Wiki/FAQ: http://cyrusimap.web.cmu.edu/twiki
List Archives/Info: http://asg.web.cmu.edu/cyrus/mailing-list.html