# NFS transfer really slow (SOLVED)

## bobspencer123

So here is a brief description. I have a nfs server running on my sheevaplug which I mount media directories on both my desktop and my laptop. The desktop is super fast with NFS. I can browse my mounted shares with thunar and copy a directory from the sheevaplug to my deskotp in  like 4 seconds (for like a 70-80 mb directory). If I try to do the same thing with my laptop it takes like 4-5 minutes. Here are the differences between the two that I can think of.

Desktop is running stable x86 and is therefore using nfs-utils 1.1.4-r1 which still requires the separate portmapper init.d daemone/script. 

The laptop is ~x86 are is therefore running nfs-utils 1.2.2-r2

The desktop is a wired connection and the laptop is a wireless connection. 

Both are connecting through nfs version 3 (I have tried 4 on the laptop and I originally thought that was the problem).

Both have the same mount options in /etc/fstab/

I do have the rpcbind service running on the laptop

Here is some info:

/etc/fstab

```

sheevaplug:/media/storage/   /media/sheevaplug   nfs   defaults,user,noauto,vers=3    0 0

sheevaplug:/media/storage1/     /media/sheevaplug1      nfs     defaults,user,noauto,vers=3 0 0

```

emerge ---info on laptop

```

emerge --info

Portage 2.1.9.3 (default/linux/x86/10.0/desktop, gcc-4.4.4, glibc-2.12.1-r1, 2.6.33-tuxonice-r2 i686)

=================================================================

System uname: Linux-2.6.33-tuxonice-r2-i686-Intel-R-_Pentium-R-_M_processor_1500MHz-with-gentoo-2.0.1

Timestamp of tree: Sat, 11 Sep 2010 03:00:22 +0000

app-shells/bash:     4.1_p7

dev-lang/python:     2.6.5-r3, 3.1.2-r4

dev-util/cmake:      2.8.1-r2

sys-apps/baselayout: 2.0.1

sys-apps/openrc:     0.6.2

sys-apps/sandbox:    2.3-r1

sys-devel/autoconf:  2.67

sys-devel/automake:  1.9.6-r3, 1.10.3, 1.11.1

sys-devel/binutils:  2.20.1-r1

sys-devel/gcc:       4.4.4-r1

sys-devel/gcc-config: 1.4.1

sys-devel/libtool:   2.2.10

sys-devel/make:      3.81-r2

virtual/os-headers:  2.6.35 (sys-kernel/linux-headers)

ACCEPT_KEYWORDS="x86 ~x86"

ACCEPT_LICENSE="*"

CBUILD="i686-pc-linux-gnu"

CFLAGS="-O2 -march=native -pipe -fomit-frame-pointer"

CHOST="i686-pc-linux-gnu"

CONFIG_PROTECT="/etc /usr/share/X11/xkb"

CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/fonts/fonts.conf /etc/gconf /etc/gentoo-release /etc/portage /etc/revdep-rebuild /etc/sandbox.d /etc/terminfo"

CXXFLAGS="-O2 -march=native -pipe -fomit-frame-pointer"

DISTDIR="/usr/portage/distfiles"

FEATURES="assume-digests distlocks fixlafiles fixpackages news parallel-fetch protect-owned sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch"

GENTOO_MIRRORS="http://gentoo.mirrors.tds.net/gentoo"

LDFLAGS="-Wl,-O1 -Wl,--as-needed"

LINGUAS="en en_US"

MAKEOPTS="-j2"

PKGDIR="/usr/portage/packages"

PORTAGE_CONFIGROOT="/"

PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --exclude=/packages"

PORTAGE_TMPDIR="/var/tmp"

PORTDIR="/usr/portage"

PORTDIR_OVERLAY="/var/lib/layman/sunrise"

SYNC="rsync://desktop/gentoo-portage"

USE="X a52 aac acl acpi alsa avi berkdb bluetooth branding bzip2 cairo cdr cli consolekit corefonts cracklib crypt cups cxx dbus dri dts dvd dvdr dvdread emboss encode exif faac fam ffmpeg firefox flac flash fortran gdbm gif gphoto2 gpm gtk http iconv jpeg lame laptop lcms ldap libnotify mad matroska mikmod mjpeg mmx mng modules mp3 mp4 mpeg mplayer mudflap ncurses nls nptl nptlonly nsplugin offensive ogg oggvorbis opengl openmp pam pango pcre pdf perl png policykit ppds pppd python qt3support readline reflection samba sdl session spell sse sse2 ssl startup-notification svg sysfs tcpd thinkpad thunar tiff truetype unicode usb vorbis win32codecs x264 x86 xcb xml xorg xulrunner xv xvid zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache cgi cgid dav dav_fs dav_lock deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling status unique_id userdir usertrack vhost_alias" CAMERAS="canon" ELIBC="glibc" INPUT_DEVICES="keyboard evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001 mtxorb ncurses text" LINGUAS="en en_US" RUBY_TARGETS="ruby18" USERLAND="GNU" VIDEO_CARDS="radeon" XFCE_PLUGINS="brightness menu trash" XTABLES_ADDONS="quota2 psd pknock lscan length2 ipv4options ipset ipp2p iface geoip fuzzy condition tee tarpit sysrq steal rawnat logmark ipmark dhcpmac delude chaos account" 

Unset:  CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LANG, LC_ALL, PORTAGE_BUNZIP2_COMMAND, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS

```

cat /usr/src/linux/.config | grep -i nfs 

on laptop

```
CONFIG_NFS_FS=y

CONFIG_NFS_V3=y

CONFIG_NFS_V3_ACL=y

CONFIG_NFS_V4=y

# CONFIG_NFS_V4_1 is not set

CONFIG_ROOT_NFS=y

# CONFIG_NFSD is not set

CONFIG_NFS_ACL_SUPPORT=y

CONFIG_NFS_COMMON=y

```

if you need more info please let me know. This is driving me batty. 

Here are some of the things I have tried.

nfsv4 and 3 on laptop.

mount options: rsize=4012, wsize=4012, async,noacl,defaults, .... combinations.

copying files via thunar and command line (to make sure it wasn't just a thunar bug)

----------

## NeddySeagoon

bobspencer123,

I suspect its the difference between wired being full duplex and faster and wireless being half duplex as well as slower.

For large transfers, I've seen the duplex setting make a factor of 10x speed difference.

To test - force your wired system to use half duplex.

----------

## Hu

Going with the idea that NeddySeagoon suggested, try also giving the laptop a wired connection, shutting down its wireless connection, then mounting the NFS export and repeating your test.

Try running the test on each system with the data fetched and discarded, rather than fetched and saved.  Discard it with something like: find /media/storage/ -type f -print0 | xargs -0 cat >/dev/null, so that every file is read, but nothing is written locally.  This will rule out discrepancies in local storage.  Since one system is a laptop and the other is a desktop, the laptop may have a slower hard drive.  Depending on the local filesystem for each machine, this could have an effect if the files are synced to local storage frequently.

 *bobspencer123 wrote:*   

> cat /usr/src/linux/.config | grep -i nfs

 This can be written simply as grep -i nfs /usr/src/linux/.config.

----------

## bobspencer123

you guys are spot on. I hooked up my laptop via the wired ethernet connection and I have comparable speeds as my desktop.

Now the real question: Is there a way to speed up the NFS transfer speed of my NFS share when I'm using wireless (which is almost all the time)?

Because I don't feel like my wireless is that slow when connected to the internet:

wired:

 speed 

wireless:

 speed 

Ok there is a differency ... but it still shouldn't take 10 minutes for a 80 mb directory to transfer when using wired it took about 3 seconds.

Any help with mount options etc... to speed things up would be appreciated.

Thanks!

----------

## NeddySeagoon

bobspencer123,

Most of the difference is accounted for by the full duplex of wired and half duplex of wireless.

You can certainly slow down your wired link. Speeding up wireless is much harder.

Use 

```
iwconfig wlan0
```

or whatever your wireless interface is to check the link speed, signal quality and signal to noise ratio.

Concentrate on getting the best link speed you can. Move the antenna, if there is one, or move the laptop.

Look at the output of 

```
iwlist wlan0 scanning
```

for APs on channels close to yours. Ideally you want six channels either side of yours to avoid collisions with other networks. The spread spectrum uses your channel plus/minus 6. When you get a collision both packets have to be resent. This reduces throughput.

Try your AP on different channels.  You will find that many people don't switch from the default.

Set some realistic expectations for what a half duplex channel can to. Force your wired link to half duplex. It will still be better than wireless can achieve but about 10x to 20x slower than full duplex.  I think ethtool can do that for you.  Run the same test as you did before but with the link in half duplex mode.

----------

## krinn

Don't compare internet speed with an hdd speed like that

the internet speed you gave for info is 3.96Mb/s with your wireless device

but Mb IS NOT MB !

Mb = megabit 

and MB = megabyte

as a byte = 8bit, you can / 8 a Mb to get it's MB equiv

so how can you compare a disk (let's say your disk is a shitty hdd that hdparm -t will gave a ridiculous 10MB/s)

in order to get the bottleneck coming from your hdd, your wireless connection must do more than 10MB*8=80Mb/s

now compare this with your 3.96Mb/s (if you prefer 3.96/8 = your wireless is doing 0.495MB/s)

I think only a floppy might get trouble following your wireless interface copying something  :Smile: 

Let's take a more serious connection, the wired one: if you have a 100Mb card your disk must substain 12.5MB/s

for a gigabit card, this time, you're getting serious, 1000 / 8 = 125MB/s (so a gigabit ethernet can put down an hdd to its knee, not all hdd, but i think any SATA1, some SATA2 too i suppose)

Ok, back to your sample, let's say your hdd can do 80MB/s so it's not your hdd fault if you have a bottleneck:

To copy over NFS 80MB of datas, using a 100Mb ethernet card, you will need: 80 / ( 100 / 8 ) = 6.4s

same but this time with your wireless speed of 3.96Mb/s: 80 / ( 3.96 / 8 )= 161.62s -> 2.69 minutes

- But why it takes 6.4s with the wire when you say 3s ?

 well, your wire must be higher than 100Mb or you just say 3s like 5s, a more or less good human estimated time.

- But why it takes 10 minutes with the wireless when it should take 2.69 ?

Because it's the time in a perfect world, many things can slow it down: and for a wireless connection, it's easy: the strength of the link. With a bad signal, your datas will get lost more and so the card must re-call the server for a re-send... So to transfer your 80MB of datas without ANY error, the card might need 2x or 3x (no limit there) more datas transfered

My recommendation: signal quality depend on the environment and distance, but also, from the material, i suppose some website test this kind of thing (i have a link but in french, not sure it might help you find a good material, but i'm sure tomshardware or website like that might have done testings too)

CPL generally are doing way better task than wireless, signal depend on electricity cables, and noise from what run on the cables (and as everyone dislike to have his house burn because of old shitty electric cable, generally they are healthy), this might be a better solve for distant nfs copy if you can't use an Ethernet cable.

----------

## bobspencer123

after re-reading your post several times Krinn I believe I know understand what you are saying. I guess I didn't realize the real difference in speeds between wired and wireless especially when we are talking about internal network speeds. I do believe I have a gigabit connection and in my internal network am probably using a lot of that speed. While, my wireless probably max's out (even internally) and the 3.x Mb per sec. 

I have no real need to use NFS and my notebook on a regular basis I was just amazed at the speed difference that I thought it must be a bug. I am also considering getting one of the WD media boxes that can take advantage of NFS and it appears I will definitely be using a wired connection to make sure HD movies are streamed properly.

Thanks again guys.

----------

