Date: Sat, 11 Aug 2018 02:35:19 +0000 From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 230491] stat(1): Improve performance with getpwuid() and getgrgid() caching Message-ID: <bug-230491-227-jMaIPV3iBU@https.bugs.freebsd.org/bugzilla/> In-Reply-To: <bug-230491-227@https.bugs.freebsd.org/bugzilla/> References: <bug-230491-227@https.bugs.freebsd.org/bugzilla/>
next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D230491 --- Comment #8 from Conrad Meyer <cem@freebsd.org> --- (In reply to Garance A Drosehn from comment #5) (In reply to Garance A Drosehn from comment #7) > but why would using nscd be so much slower than doing a totally non-cache= d look > up of the user and group names each time? Doesn't that seem a little odd? You're totally right, that does seem suspect. Maybe our ncsd isn't the same one as on Linux, or is an older version, or has some other deficiency? I a= dmit total lack of familiarity with any version or use of ncsd. :-) > And the local-to-stat caching: won't that only help if many commands are > 'stat'-ed in a single command, as opposed to doing many stat-commands wit= h one > file per command? Correct. That's the use case described in Thomas' description, although I don't know if it represents any realworld workflow or if it's just an arbit= rary pessimistic microbenchmark. If the latter, I don't think it's worth bringi= ng in the stat(1) patch. (Even if it is a real-world use, the non-general optimization is questionable and we need to investigate why ncsd doesn't so= lve the problem first.) > Does 'ls' do local caching? If there is a big benefit in doing local-cac= hing > in 'stat', should we also do it with 'ls'? I know I do a lot more 'ls -l= 's > than I do 'stat'-commands of any kind. Another great question, and the answer is yes =E2=80=94 through a 3rd metho= d. ls uses user_from_uid(), group_from_gid(), which caches any implementation of getpwuid() / getgrgid(). Fortunately, libc's default implementation of the= se routines already uses _nsdispatch(), so it is not limited to local /etc/pas= swd. So tl;dr: Instead of this patch, stat(1) should just use user_from_uid(3) / group_from_gid(3) (pwcache(3) API). --=20 You are receiving this mail because: You are the assignee for the bug.=
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-230491-227-jMaIPV3iBU>