From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fe50f,bb1fc5b19977db88,start X-Google-Attributes: gidfe50f,public X-Google-Thread: fee84,8b0a083ee91d4832 X-Google-Attributes: gidfee84,public From: nospam@zk3.dec.com (Eric Werme - replace nospam with werme) Subject: Re: NFS linux->osf1 slow, linux->irix fast Date: 1999/01/26 Message-ID: <78lgua$m3s$1@nntpd.lkg.dec.com> X-Deja-AN: 437289074 References: Organization: Digital Equipment Corporation Reply-To: (Replace nobody with werme) nobody@zk3.dec.com Newsgroups: comp.unix.osf.osf1,comp.protocols.nfs [Note new cross posting to comp.protocols.nfs] Remco Wouts writes: >We have a mixed network of machines running linux, osf1, and irix. All >machines serve disks to each other over NFS. There seems to be a huge >performance problem when writing on linux to disks mounted from our >ALPHA'S, whereas writing to the SGI's works as advertised. I did a >dejanews search and a few people mention the same problem but no >solution has been posted. Usually linux get's the blame. Since >everything works fine with IRIX I really think there is something >funny with the NFS2 implementation under OSF1. Technically, there's something funny with SGI. And something really ancient with Linux. What you're seeing is a protocol-compliant Digital UNIX system fed by a Linux client that isn't using a basic NFS acceleration technique that Digital UNIX expects. A "proper" NFS V2 NFS server doesn't return a write reply until all data is securely on disk. That way, if you write foo.c, and the server loses power, the data will still be on the server when it comes back. In practice, this means something like three disk writes per NFS write, usually with a seek in between: 1) Data 2) Indirect block 3) Inode (where file size and other metadata lives). Most NFS clients, run a program called biod or nfsiod that provides additional threads that take of the task of sheparding writes to completion. Digital UNIX takes that a step further and _expects_ clients to be doing that (look at nfsiod(8) on Digital UNIX for more details and notes on read ahead). Digital UNIX servers use a technique called "write gathering" to greatly speed up NFS V2 writes. When the first write comes in the server releases the data to the disk, but doesn't reply. It sleeps for a bit to allow more requests to come in. Those just send the data to the disk and add don't reply. Eventually the first wakes up, looks around for more requests that haven't been processed yet. Ultimately, some server thread concludes no more are likely to show up, commits all the data and metadata, and returns replies for all the writes. We try to tune the system to gather 8 writes (64KB) at a time. Three seeks, 3-10 disk writes (we gather disk writes too!) - a lot better than a simple server. I've only recently received confirmation that Linux isn't using biod, at least not by default. If you can find biod, run it! Worse, Linux is doing a mere 1 KB write. Just about everyone else (well, discounting NT), sends 8 KB or more. If Linux sent 8 KB, its throughput would be about 8X faster. See if you can do that. The worst thing, at least in my mind, is that Linux is using NFS V2. We fixed the NFS write performance problem in NFS V3, which has shipped on Digital UNIX since 1994. What you show here is about state of the art for 1985. Why, oh why hasn't anyone ported FreeBSD's NFS to Linux yet? V3, biods, TCP, a server in the kernel, all sorts of great stuff. As for SGI, you're using something called asynchronous mode where the server replies to the writes but hasn't committed your data to disk. Even if you call fsync(2) or sync(2) on the client, your data won't be written. Digital has never supported that mode, relying on write gathering or Presto support (battery-backed cache RAM) for V2 performance. With the advent of NFS V3 there's little impetus to enhance/corrupt NFS V2. Your simplest solution is to buy a Presto board for the Digital UNIX server, but I'd be delighted if you brought Linux into the 1990s. Somewhat of a workaround is to patch the Digital UNIX server with dbx. Change variable nfs_ufs_lbolt from 1 to 0 and it will skip that sleep before looking for other in progress NFS writes. That should save 8 msec per write request. Hmm. We should reduce that ourselves, we sleep only 2 msec on writes received on FDDI, the same speed as your 100 Mbit Ethernet. BTW, this is fairly recent news to us too. I wanted to check RedHat 5.2, look for biod, and maybe find the Linux NFS community before addressing this, but this timing is okay too. :-) [Remainder here is for comp.protocols.nfs readers. Hi, guys.] >Attached is the output of tcpdump for writing to files on disk on two >of our machines, everything is on 100Mb ethernet half duplex. The >problem seems to be that under OSF1 writes are serialized and under >IRIX they are not. The same thing is seen when writing large amount of >blocks. >TCPDUMP >------- >Linux rembrandt.bmc.uu.se 2.0.36 >IRIX bosch 6.3 12161207 IP32 >OSF1 carr.bmc.uu.se V4.0 564.32 alpha >dd if=/dev/zero of= bs=1024 count=5 >09:51:46.643697 rembrandt.1427250621 > carr.nfs: 152 lookup [|nfs] >09:51:46.643697 carr.nfs > rembrandt.1427250621: reply ok 128 lookup [|nfs] >09:51:46.643697 rembrandt.1427250622 > carr.nfs: 148 lookup [|nfs] >09:51:46.643697 carr.nfs > rembrandt.1427250622: reply ok 128 lookup [|nfs] >09:51:46.643697 rembrandt.1427250623 > carr.nfs: 172 setattr [|nfs] >09:51:46.663697 carr.nfs > rembrandt.1427250623: reply ok 96 setattr [|nfs] >09:51:46.663697 rembrandt.1427250624 > carr.nfs: 1180 write [|nfs] >09:51:46.693697 carr.nfs > rembrandt.1427250624: reply ok 96 write [|nfs] >09:51:46.693697 rembrandt.1427250625 > carr.nfs: 1180 write [|nfs] >09:51:46.743697 carr.nfs > rembrandt.1427250625: reply ok 96 write [|nfs] >09:51:46.743697 rembrandt.1427250626 > carr.nfs: 1180 write [|nfs] >09:51:46.803697 carr.nfs > rembrandt.1427250626: reply ok 96 write [|nfs] >09:51:46.803697 rembrandt.1427250627 > carr.nfs: 1180 write [|nfs] >09:51:46.863697 carr.nfs > rembrandt.1427250627: reply ok 96 write [|nfs] >09:51:46.863697 rembrandt.1427250628 > carr.nfs: 1180 write [|nfs] >09:51:46.913697 carr.nfs > rembrandt.1427250628: reply ok 96 write [|nfs] >dd if=/dev/zero of= bs=1024 count=5 >09:51:51.273697 rembrandt.1427250629 > bosch.nfs: 152 lookup [|nfs] >09:51:51.273697 bosch.nfs > rembrandt.1427250629: reply ok 128 lookup [|nfs] >09:51:51.273697 rembrandt.1427250630 > bosch.nfs: 148 lookup [|nfs] >09:51:51.273697 bosch.nfs > rembrandt.1427250630: reply ok 128 lookup [|nfs] >09:51:51.273697 rembrandt.1427250631 > bosch.nfs: 172 setattr [|nfs] >09:51:51.293697 bosch.nfs > rembrandt.1427250631: reply ok 96 setattr [|nfs] >09:51:51.293697 rembrandt.1427250632 > bosch.nfs: 1180 write [|nfs] >09:51:51.293697 bosch.nfs > rembrandt.1427250632: reply ok 96 write [|nfs] >09:51:51.293697 rembrandt.1427250633 > bosch.nfs: 1180 write [|nfs] >09:51:51.293697 bosch.nfs > rembrandt.1427250633: reply ok 96 write [|nfs] >09:51:51.293697 rembrandt.1427250634 > bosch.nfs: 1180 write [|nfs] >09:51:51.293697 bosch.nfs > rembrandt.1427250634: reply ok 96 write [|nfs] >09:51:51.293697 rembrandt.1427250635 > bosch.nfs: 1180 write [|nfs] >09:51:51.293697 bosch.nfs > rembrandt.1427250635: reply ok 96 write [|nfs] >09:51:51.293697 rembrandt.1427250636 > bosch.nfs: 1180 write [|nfs] >09:51:51.293697 bosch.nfs > rembrandt.1427250636: reply ok 96 write [|nfs] -- <> Eric (Ric) Werme <> The above is unlikely to contain <> <> ROT-13 addresses: <> official claims or policies of <> <> <> Compaq Computer Corp. <> <> <> http://www.cyberportal.net/werme <>