Skip to contentSkip to conversation

Kernel 2.6.15.1 + NFS is 4 times slower than FTP!?

DISCUSSION Justin Piszcz 7 participants 22 messages Jan 17, 2006 – Jan 18, 2006

lore
Share & tools
lore
#0 lore raw

Now that I have 74GB raptors in both of my Linux boxes, I thought I would compare throughput between FTP and NFS over a gigabit network.

I am using the same kernel versions and same motherboard on both machines and even the same raptor hdd model.

Here are my results:

NFS, COPY 700MB FILE FROM 1 RAPTOR TO ANOTHER RAPTOR VIA GIGABIT ETHERNET:

$ cp file /remote/dst
0.02user 1.86system 0:38.07elapsed 4%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+196minor)pagefaults 0swaps

FTP, SAME

lftp> put file
733045488 bytes transferred in 10 seconds (67.38M/s)

What is wrong with NFS?

NFS options used: rw,bg,hard,intr,nfsvers=3 Is it doing some kind of weird caching?
I am using NFSv3 & XFS as the filesystem, any ideas?

I suppose I should try NFS with TCP, yes?

Thanks!

Justin.

#1 lore raw
Quoted 1 line · Justin Piszcz

I suppose I should try NFS with TCP, yes?

Precisely.

Phil

#2 lore raw

Also, some people mentioned tuning, I used 8192 as the w/r size it then took 15 seconds, with 65535 it took 28 seconds.

I wonder how much faster NFS over TCP would be, or if NFS in the kernel is the problem itself?

Will try later thanks.

FTP seems to be the winner for now:

<--- 226 8.927 seconds (measured here), 78.31 Mbytes per second 733045488 bytes transferred in 9 seconds (77.08M/s)

Quoted 7 lines · Phil Oester
Quoted 1 line · Justin Piszcz

I suppose I should try NFS with TCP, yes?

Precisely.

Phil

#3 lore raw
Quoted 3 lines · Justin Piszcz

Also, some people mentioned tuning, I used 8192 as the w/r size it then took 15 seconds, with 65535 it took 28 seconds.

I wonder how much faster NFS over TCP would be, or if NFS in the kernel is the problem itself?

On Linux NFS over TCP is slower than over UDP ~10%.

kloczek

Signature · 4 lines
-----------------------------------------------------------
*Ludzie nie mają problemów, tylko sobie sami je stwarzają*
-----------------------------------------------------------
Tomasz Kłoczko, sys adm @zie.pg.gda.pl|*e-mail: [email protected]*
#4 lore raw
Quoted 4 lines · Tomasz Kłoczko
Quoted 2 lines

I wonder how much faster NFS over TCP would be, or if NFS in the kernel is the problem itself?

On Linux NFS over TCP is slower than over UDP ~10%.

For the specific case you measured. Its never quite that simple because behaviour over different networks and error patterns varies a lot and TCP can be a big win on loaded networks or under error conditions, especially packet loss, where fragmentation losses kill throughput on UDP.

#5 lore raw

Alan, is it normal for FTP to be 2x as fast as NFS?
With 100mbps, I never seemed to have any issues, but with GIGABIT I definitely see all sorts of weird issues.

Quoted 13 lines · Alan Cox
Quoted 4 lines · Tomasz Kłoczko
Quoted 2 lines

I wonder how much faster NFS over TCP would be, or if NFS in the kernel is the problem itself?

On Linux NFS over TCP is slower than over UDP ~10%.

For the specific case you measured. Its never quite that simple because behaviour over different networks and error patterns varies a lot and TCP can be a big win on loaded networks or under error conditions, especially packet loss, where fragmentation losses kill throughput on UDP.

#6 lore raw
Quoted 3 lines · Justin Piszcz

Alan, is it normal for FTP to be 2x as fast as NFS?
With 100mbps, I never seemed to have any issues, but with GIGABIT I definitely see all sorts of weird issues.

NFS performance is limited by the fact it is a file system so sees only what the file system can tell it. It also takes a hit because it has strict rules on committing data to disk before acknowledging it (so data is not lost over a crash). That makes NFS a bigger user of CPU resources and more disk dependant than FTP which simply throws the entire file down the pipe when in binary mode, does no processing and makes no guarantee about restarts or what hits disk

#7 lore raw
In reply to Justin Piszcz
Quoted 3 lines · Justin Piszcz

Alan, is it normal for FTP to be 2x as fast as NFS?
With 100mbps, I never seemed to have any issues, but with GIGABIT I definitely see all sorts of weird issues.

Reading or writing?

The readahead algorithm has been borken in 2.6.x for at least the past 6 months. It leads to NFS collapsing down to 4k reads on the wire instead of doing 32k or 64k.
An effort was made to look at fixing this, but it turns out that nobody really understands the current messy implementation, and so progress has been slow.

Cheers,
Trond

#8 lore raw

Writing from SRC(A) -> DST(B).
I have not tested reading, but as I recall there were similar speed issues going the other way too, although I have not tested it recently.

Justin.

Quoted 17 lines · Trond Myklebust
Quoted 3 lines · Justin Piszcz

Alan, is it normal for FTP to be 2x as fast as NFS?
With 100mbps, I never seemed to have any issues, but with GIGABIT I definitely see all sorts of weird issues.

Reading or writing?

The readahead algorithm has been borken in 2.6.x for at least the past 6 months. It leads to NFS collapsing down to 4k reads on the wire instead of doing 32k or 64k.
An effort was made to look at fixing this, but it turns out that nobody really understands the current messy implementation, and so progress has been slow.

Cheers,
Trond

#9 lore raw
Quoted 3 lines · Justin Piszcz

Writing from SRC(A) -> DST(B).
I have not tested reading, but as I recall there were similar speed issues going the other way too, although I have not tested it recently.

How were you testing it? I'm not sure that ftp will actually sync your file to disk (whereas that is pretty much mandatory for an NFS server), so unless you are transferring very large files, you would expect to see a speed difference due to caching of writes by the server.

Cheers,
Trond

#10 lore raw

Did you get my other e-mail?

$ cp file /nfs/destination
$ lftp> put file
Quoted 13 lines · Trond Myklebust
Quoted 3 lines · Justin Piszcz

Writing from SRC(A) -> DST(B).
I have not tested reading, but as I recall there were similar speed issues going the other way too, although I have not tested it recently.

How were you testing it? I'm not sure that ftp will actually sync your file to disk (whereas that is pretty much mandatory for an NFS server), so unless you are transferring very large files, you would expect to see a speed difference due to caching of writes by the server.

Cheers,
Trond

#11 lore raw
Quoted 4 lines · Justin Piszcz

Did you get my other e-mail?

$ cp file /nfs/destination
$ lftp> put file

Yes, but how big a file is this? Is it significantly larger than the amount of cache memory on the server? As I said, if ftp is failing to sync the file to disk, then you may be comparing apples and oranges.

Cheers,
Trond

Quoted 15 lines · Trond Myklebust
Quoted 14 lines · Justin Piszcz
Quoted 3 lines

Writing from SRC(A) -> DST(B).
I have not tested reading, but as I recall there were similar speed issues going the other way too, although I have not tested it recently.

How were you testing it? I'm not sure that ftp will actually sync your file to disk (whereas that is pretty much mandatory for an NFS server), so unless you are transferring very large files, you would expect to see a speed difference due to caching of writes by the server.

Cheers,
Trond

#12 lore raw

The file is 700MB.

Machine A (src) has 2GB of RAM / 2GB of swap
Machine B (dst) has 1GB of RAM / 2GB of swap.

Justin.

Quoted 30 lines · Trond Myklebust
Quoted 4 lines · Justin Piszcz

Did you get my other e-mail?

$ cp file /nfs/destination
$ lftp> put file

Yes, but how big a file is this? Is it significantly larger than the amount of cache memory on the server? As I said, if ftp is failing to sync the file to disk, then you may be comparing apples and oranges.

Cheers,
Trond

Quoted 15 lines · Trond Myklebust
Quoted 14 lines · Justin Piszcz
Quoted 3 lines

Writing from SRC(A) -> DST(B).
I have not tested reading, but as I recall there were similar speed issues going the other way too, although I have not tested it recently.

How were you testing it? I'm not sure that ftp will actually sync your file to disk (whereas that is pretty much mandatory for an NFS server), so unless you are transferring very large files, you would expect to see a speed difference due to caching of writes by the server.

Cheers,
Trond

#13 lore raw
In reply to Trond Myklebust
Quoted 9 lines
Quoted 4 lines

Did you get my other e-mail?

$ cp file /nfs/destination
$ lftp> put file

Yes, but how big a file is this? Is it significantly larger than the amount of cache memory on the server? As I said, if ftp is failing to sync the file to disk, then you may be comparing apples and oranges.

Ok, so what happens if you use NFS with the async option, does it go a little faster?

Jan Engelhardt

#14 lore raw

auto Can be mounted with the -a option.

defaults
Use default options: rw, suid, dev, exec, auto, nouser, and async.

The default is async, no?

Quoted 19 lines · Jan Engelhardt
Quoted 9 lines
Quoted 4 lines

Did you get my other e-mail?

$ cp file /nfs/destination
$ lftp> put file

Yes, but how big a file is this? Is it significantly larger than the amount of cache memory on the server? As I said, if ftp is failing to sync the file to disk, then you may be comparing apples and oranges.

Ok, so what happens if you use NFS with the async option, does it go a little faster?

Jan Engelhardt

#15 lore raw
Quoted 7 lines

auto Can be mounted with the -a option.

defaults
Use default options: rw, suid, dev, exec, auto,
nouser, and async.

The default is async, no?

The server side also needs to specify async in exports. You even get a warning if you do not specify sync or async, because the default had been changed once.

Jan Engelhardt

#16 lore raw
Quoted 6 lines · Jan Engelhardt
Quoted 6 lines

auto Can be mounted with the -a option.

defaults
Use default options: rw, suid, dev, exec, auto,
nouser, and async.

Quoted 6 lines
Quoted 1 line

The default is async, no?

The server side also needs to specify async in exports. You even get a warning if you do not specify sync or async, because the default had been changed once.

What is the date on the above man page? Looks like the docs need to be updated.

I believe the default was originally async, which violates the NFS spec and is dangerous, and changed to sync at some point.

Lee

#17 lore raw

man mount

Quoted 22 lines · Lee Revell
Quoted 6 lines · Jan Engelhardt
Quoted 6 lines

auto Can be mounted with the -a option.

defaults
Use default options: rw, suid, dev, exec, auto,
nouser, and async.

Quoted 6 lines
Quoted 1 line

The default is async, no?

The server side also needs to specify async in exports. You even get a warning if you do not specify sync or async, because the default had been changed once.

What is the date on the above man page? Looks like the docs need to be updated.

I believe the default was originally async, which violates the NFS spec and is dangerous, and changed to sync at some point.

Lee

#18 lore raw
Quoted 2 lines · Justin Piszcz

man mount

async is the default for most filesystems but the NFS standard requires writes to be synchronous.

Lee

#19 lore raw
Quoted 6 lines · Lee Revell
Quoted 2 lines · Justin Piszcz

man mount

async is the default for most filesystems but the NFS standard requires writes to be synchronous.

On the server side, note. Not the client side. Justin appears to be looking at the client, whereas you are referring to an export option on the server.

The client only guarantees that writes must have been committed to disk on the server when either fsync() or close() have been called.

Cheers,
Trond

#20 lore raw
In reply to Phil Oester

NFS is still twice as slow as FTP, but best with a r/w size of 8192.

DEFAULT, NO OPTIONS

# mount p34:/ /nfs/p34
$ /usr/bin/time cp 700mb.img  /p34/x/d
0.01user 1.64system 0:34.23elapsed 4%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+196minor)pagefaults 0swaps

TCP, NO CACHING

# mount p34:/ /nfs/p34 -o nfsvers=3,tcp,noac
$ /usr/bin/time cp 700mb.img  /p34/x/a
0.02user 5.25system 0:58.43elapsed 9%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+197minor)pagefaults 0swaps

UDP, NO CACHING

# mount p34:/ /nfs/p34 -o nfsvers=3,noac
$ /usr/bin/time cp 700mb.img  /p34/x/b
0.02user 5.54system 1:00.34elapsed 9%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+196minor)pagefaults 0swaps

UDP, NO CACHING (w/65535 r/w size)

# mount p34:/ /nfs/p34 -o nfsvers=3,noac,rsize=65535,wsize=65535
$ /usr/bin/time cp 700mb.img  /p34/x/c
0.01user 5.75system 0:59.89elapsed 9%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+196minor)pagefaults 0swaps
# mount p34:/ /nfs/p34 -o nfsvers=3,rsize=8192,wsize=8192
0.04user 1.78system 0:14.16elapsed 12%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+190minor)pagefaults 0swaps

UDP, NFSV3 + (w/8192 r/w size)

$ /usr/bin/time cp 700mb.img  /p34/x/g
0.04user 1.78system 0:14.16elapsed 12%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+190minor)pagefaults 0swaps

TCP, NFSV3 + (w/8192 r/w size)
0.03user 1.81system 0:14.98elapsed 12%CPU (0avgtext+0avgdata 0maxresident)k 0inputs+0outputs (0major+190minor)pagefaults 0swaps

UDP, NFSV3 + (w/16384 r/w size)

# mount p34:/ /nfs/p34 -o nfsvers=3,rsize=16834,wsize=16384
$ /usr/bin/time cp 700mb.img  /p34/x/e
0.03user 1.75system 0:20.20elapsed 8%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+192minor)pagefaults 0swaps

UDP, NFSV3 + (w/32768 r/w size)

# mount p34:/ /nfs/p34 -o nfsvers=3,rsize=32768,wsize=32768
 /usr/bin/time cp 700mb.img  /p34/x/f
0.01user 1.59system 0:32.87elapsed 4%CPU (0avgtext+0avgdata 0maxresident)k
0inputs+0outputs (0major+196minor)pagefaults 0swaps
Quoted 7 lines · Phil Oester
Quoted 1 line · Justin Piszcz

I suppose I should try NFS with TCP, yes?

Precisely.

Phil

#21 lore raw
Quoted 2 lines

NFS is still twice as slow as FTP, but best with a r/w size of 8192.

Screams for a kftpd ;)

Jan Engelhardt

Signature · 2 lines
| Alphagate Systems, http://alphagate.hopto.org/
| jengelh's site, http://jengelh.hopto.org/