Path: utzoo!utgpu!watserv1!watmath!att!linac!pacific.mps.ohio-state.edu!zaphod.mps.ohio-state.edu!swrinde!cs.utexas.edu!uunet!mcsun!ukc!icdoc!qmw-cs!liam From: liam@cs.qmw.ac.uk (William Roberts;) Newsgroups: comp.protocols.nfs Subject: Re: how many nfsd's should I run? Message-ID: <2936@redstar.cs.qmw.ac.uk> Date: 25 Feb 91 19:34:40 GMT References: <28975@cs.yale.edu> Sender: usenet@cs.qmw.ac.uk Lines: 46 Nntp-Posting-Host: whitesand In <4218@skye.ed.ac.uk> richard@aiai.ed.ac.uk (Richard Tobin) writes: >In article <1991Feb22.012532.26075@murdoch.acc.Virginia.EDU> gl8f@astsun7.astro.Virginia.EDU (Greg Lindahl) writes: >>If you have too many processes competing for the limited slots in the >>hardware context cache, your machine will roll over and die. >Given that nfsd runs in kernel mode inside nfssvc(), is this statement >about contexts correct? If so, why is the default number of nfsds for >Sun 3s 8? 1) Hardware contexts are a feature of the MMU/Instruction cache, and so Greg's comment is specific to Sun4 machines. 2) The nfssvc() system call never returns, but the process slot of the caller is used as a cheap way to implement multi-threading in the kernel. When an nfsd runs out of work, it does a sleep() waiting for requests to come in on the socket bound to UDP port 2049. When it gets handles a request involving disk I/O, it sleeps waiting for the result. All nice straightforward kernel stuff provided that you have a process table entry to work with, but impossible if you don't. Using a kernel like Mach or Chorus it would be done with true multi-threading of the code, so lightweight process switches would be the only overhead; under most UNIX systems it takes the full context switch and hence can thrash the hardware contexts (if applicable). Historical note: prior to SunOS 3.2, there was no wakeupone() routine and so ALL sleeping nfsd processes would be made runnable when a request came in. One would get to handle the request, and the others would needlessly run, find nothing to do and go back to sleep. Under this scheme it was possible to find that the file server got slower at night, and needless to say it was impossible to choose a "good number" since there were penalties for having too many for the current load. I once tried 30 nfsds on a WhiteChapel MG1 server: it stopped. Nowadays only one nfsd will wake up for an incoming request, hence the change in "good number" from "4" to "4 or more". One plausible way to determine how many nfsds you need is to ask for lots, then see how many use up CPU time (NB. this depends on sleep queues being managed unfairly, so it might not work these days). -- William Roberts ARPA: liam@cs.qmw.ac.uk Queen Mary & Westfield College UUCP: liam@qmw-cs.UUCP Mile End Road AppleLink: UK0087 LONDON, E1 4NS, UK Tel: 071-975 5250 (Fax: 081-980 6533)