# FreeBSD 9.0 nfsd cpu problem



## stanojr (Sep 13, 2012)

Hello,

we have two storage servers with FreeBSD 9.0 for webservers. We use zfs+nfsd and we have problem with nfsd performance which eat too much cpu.

```
PID USERNAME  THR PRI NICE   SIZE    RES STATE   C   TIME   WCPU COMMAND
29833 root       33  40    0 10008K   884K rpcsvc  0 1479.5 949.12% nfsd
```
We try set different threads from 4 to 32 without success.

Clients are linux and main application accessing nfs mounts is apache+php, so it make lots of access/lookup/readdir requests.

output from nfsstat -s 1

```
GtAttr Lookup Rdlink   Read  Write Rename Access  Rddir
   2334    947      0     43      0      0   1192    210
   2179    885      0     73      0      0   1074    356
   2078    773      0     76      0      0    983    358
   2534   1002      0     70      0      0   1220    156
   2470    987      0     60      0      0   1181    164
   2452   1062      0     45      0      0   1224    151
   2504   1022      0     24      0      0   1233    170
   2557   1077      0     17      0      0   1231    142
   2473   1016      0     34      0      0   1187    170
   2563   1143      0     11      0      0   1247    157
   2401   1019      0     79      0      0   1181    205
```
Any advice to solve this problem ?

Thanks


----------



## SirDice (Sep 13, 2012)

You might want to turn off atime on that filesystem.

From mount(8):

```
noatime
                     Do not update the file access time when reading from a
                     file.  This option is useful on file systems where there
                     are large numbers of files and performance is more criti-
                     cal than updating the file access time (which is rarely
                     ever important).  This option is currently only supported
                     on local file systems.
```

From zfs(8):

```
atime=on | off

           Controls whether the access time for files is updated when they are
           read. Turning this property off avoids producing write traffic when
           reading  files  and  can  result  in significant performance gains,
           though it might confuse mailers and other  similar  utilities.  The
           default value is on.
```


----------



## stanojr (Sep 13, 2012)

of course we have already atime off for nfs/zfs/client, and zfs sync disabled


----------



## pboehmer (Sep 14, 2012)

Can we see relevant sections of rc.conf and the nfs mount options of the web servers?  Also might help if we had system (cpu/memory) specs of the nfs server along with memory usage info from top.


----------

