# NFS async transfers of large files hang the client machine

## volumen1

Ok.  So, this took me a long time to figure out what exactly was burning me, so please be patient because I want to give you as much information as possible.

Long story short, when I try to transfer large (greater than 1G) files over NFS, it usually results in the hang of my client machine.  When I watch my gkrellm monitors, what happens first is that my client hard drive activity pegs at like 100M/s for a few seconds and then I start to see roughly 3-5M/s of transfers over my network interface.  This goes for about 10 seconds and then, usually, the client machine hangs.  If I wait a long time (10-30 minutes) sometimes it will come back, but I often don't have the time for this.

Long story short, this evening I've discovered that this problem doesn't happen if change my NFS mount options from async to sync.  (The fact that it never happens on CIFS mounted shares lead me down this path).

So, here's an example fstab entry for a share that does this:

```

nasserver.mydomain.com:/USBBACKUP /usbbackup         nfs             tcp,async,nfsvers=3,defaults,rsize=32768,wsize=32768 0 0

```

So, just changing this from async to sync makes my problem go away, but I want to figure out what is actually happening.  My guess is that it's related to the buffer that NFS uses to cache writes. 

This is a 64-bit system.  Here's uname -a info:

```

Linux clientmachine 2.6.32-gentoo-r7 #2 SMP PREEMPT Wed Jun 9 10:04:31 MDT 2010 x86_64 Dual Core AMD Opteron(tm) Processor 290 AuthenticAMD GNU/Linux

```

The system has 5G of RAM and 15G of swap.

The problem is easily reproducible with either nfs-utils 1.1.4-r1 or 1.2.2-r1.  The NFS server is a ReadyNAS appliance from Netgear, however, I can also make it happen when writing to an NFS share on a popcornhour network media tank.  It appears to be entirely client related.

Hmm... I'm sure there's more information I could provide, but I'm a little frazzled right now.  Does anyone have any ideas?  I'm hoping to make async work because I expect it to be a little bit faster, but maybe I should just drop it and stay with synchronous transfers.

----------

## Jimini

I have experienced this problem a few months ago, too. Unfortunately, I am not sure how I solved it - but my server (in this case a NFS client) mounts a NFS share with the options "hard" and "intr" and it works fine. Every morning the NFS-client mounts the share and creates a tarball on it. A few days ago, an other client had exactly the same problem as you describe it, it mounted the share with "defaults". So I guess, it could be worth a try to test your setup with the options "hard" and "intr".

Best regards,

Jimini

----------

## volumen1

You are also using "async" as an option?

----------

## Jimini

Oh, I forgot that. 

This is the entry from the server's /etc/exports:

```
/home/share/backup/Aleph 10.0.0.1(rw,subtree_check)
```

This is the entry from the client's fstab:

```
10.0.0.2:/home/share/backup/Aleph       /home/backup/   nfs     hard,intr
```

Best regards,

Jimini

----------

