Date: Sat, 19 Jul 1997 07:39:51 -0700 From: Fred Gilham <gilham@csl.sri.com> To: hackers@FreeBSD.ORG Subject: NFS wierdness? Message-ID: <199707191439.HAA12910@japonica.csl.sri.com>
next in thread | raw e-mail | index | archive | help
I have this user who runs programs that generate lots of output to stdout. The output sometimes contains very long `lines'---long stretches of output without a newline. The programs are also supposed to be very CPU intensive. Most of the time he invokes them like this: user-program >> output Unfortunately when he does this on a FreeBSD box where the directory he's writing to is NFS mounted, he gets almost no CPU time; the process spends most of its time in the `nfsfsy' state (according to top). Here's a program that basically simulates the user's programs: ---------------------------------------- #include <stdio.h> int main(int argc, char *argv[]) { long rnum = rand(); long i; while(1) { for(i = 0; i < 10000; rnum = rand(), i++) { printf("%ld ", rnum); } fflush(stdout); /* Soak up some CPU time. */ for(i = 0; i < 1000000; i++) rnum *= rnum; } } ---------------------------------------- I called the program `tester' for FreeBSD and `tester.sol' for the ultrasparc. Here's a top output line for a FreeBSD-2.2.2 box running on a Pentium Pro 200: 16639 gilham -5 0 148K 300K nfsfsy 0:10 16.18% 15.49% tester Here's one on an Ultrasparc 167MhZ: 6755 gilham -25 0 736K 584K run 0:42 36.86% 87.84% tester.sol This gives an idea of the problem; usually the user sees 98% cpu utilization on an ultrasparc and around 2% on a FreeBSD box. Both of these boxes are on the same network segment as the directory they're writing to. They were invoked as follows: tester >> dummy and tester.sol >> dummy Another symptom of the problem is that it's not possible to get any output from tail -f dummy on the same box that's running on tester program under FreeBSD. However, solaris has no problems. Just for comparison we also tried invoking the program as tester > dummy This gave somewhat better results: 16792 gilham 47 0 148K 300K RUN 0:21 27.21% 26.66% tester but the program still spent a lot of time in the `nfsaio' state. With the user's program he saw a similar improvement---from 2% to 4%. But still not very useful. Here's the solaris top line by comparison: 6772 gilham -25 0 736K 584K run 1:00 52.97% 94.41% tester.sol The bottom line is that the user's program runs really slowly under FreeBSD when he tries to save the output to an nfs-mounted directory. Does anyone have any suggestions as to what might be going on? -Fred Gilham gilham@csl.sri.com
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199707191439.HAA12910>