Date: Tue, 29 Aug 1995 20:07:00 -0400 (EDT) From: A boy and his worm gear <wpaul@skynet.ctr.columbia.edu> To: bugs@ns1.win.net (Mark Hittinger) Cc: hackers@freebsd.org Subject: Re: pwd_mkdb is intense Message-ID: <199508300007.UAA02100@skynet.ctr.columbia.edu> In-Reply-To: <199508291815.OAA02459@ns1.win.net> from "Mark Hittinger" at Aug 29, 95 02:15:46 pm
next in thread | previous in thread | raw e-mail | index | archive | help
Of all the gin joints in all the world, Mark Hittinger had to walk into mine and say: > We have a rather large password file and I can hear the system groaning > whenever someone changes their password. Top shows the process go to > about 20-30% of the P90 for around 2 or 3 minutes. Swap space in use > increases by around 15% during this period. Ouch. How large is large, if I may ask? > chpass/passwd all pass the buck to pwd_mkdb which recreates the entire > file. Well, I think it sort of has to... > Is there a utility which updates the various keys in the db for just one > particular user id? Would the db routines that pwd_mkdb calls actually > support the in-place update of a particular record? :-) I think you can just overwrite a particular record, but there are other things involved. pwd_mkdb does quite a lot of work. It has to generate /etc/passwd from /etc/master.passwd. It has to generate both /etc/pwd.db and /etc/spwd.db. And each of these databases contains not one, not two, but three copies of the user information: one set of data is keyed by UID (for getpwuid()), the second is keyed by username (for getpwnam()) and the third is keyed 'by number' (for getpwent()) which is to say that the records are keyed by the line numbers which they occupied in the original /etc/master.passwd file. (If you use NIS, it also stores the magic '+' and '-' entries, but these usually take up only a small percentage of the database.) And it has to do all this in such a way that it doesn't leave itself open to race conditions. Yeah, this seems like a long way to go, but it's a trade-off: by spending a lot of time creating the database, you make database lookups much faster. I think it's possible to just extend or modify the databases for the KEYBYUID and KEYBYNAME cases, but you'd have to do some juggling to get KEYBYNUM to work right. Removing records is something else again. > Regards, > > Mark Hittinger > bugs@win.net -Bill -- ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~T~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Bill Paul (212) 854-6020 | System Manager Work: wpaul@ctr.columbia.edu | Center for Telecommunications Research Home: wpaul@skynet.ctr.columbia.edu | Columbia University, New York City ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ The Møøse Illuminati: ignore it and be confused, or join it and be confusing! ~~~~~~ "Welcome to All Things BSDish! If it's not BSDish, it's crap!" ~~~~~~~
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199508300007.UAA02100>