The latest installment of Mike's Fine Mountd Hackary (MFMH).
Previously on MFMH: * Our hero added incremental kernel export updates to mountd so that a single update would finish within his lifetime, * Hero subsequently discovers that an incremental update still takes 8 seconds on the Emulab Mothership, * Hero discovers that remaining time is spent NOT in kernel operations or even complex calculations of orbital mechanics, but rather in simple parsing of text from a 1300 line file. * Hero gives up in despair. This week on MFMH: * Our revitalized hero applies gprof-fu to the problem and discovers that 7.9 seconds of the 8 second /etc/exports parse time is spent stat()ing /etc/nsswitch.conf 2,392,057 times. * "WtF!", exclaims our hero, "that is 27.3 stats for every text character in the file!" * Problem is traced to the fact that we do "-maproot=root" for each of the 1344 exports and every parse of that option looks up root in the password file and determines which of the 1784 groups in /etc/group root belongs to. Each of those 1344 * 1784 "get group entry" calls, stats /etc/nsswitch.conf to see if the file has changed. * "Bite me!", sez Mike, and he adds a CACHE_ROOT_CREDS option to mountd so that the lookup is only done on the very first instance of -maproot=root. A single incremental update of exports now takes 0.75 seconds.
Showing with 127 additions and 31 deletions