# FreeBSD Samba member server CPU load



## DrJohnnyFever (May 24, 2017)

Greeting all

I'm migrating our network storage on to a FreeBSD machine with Samba 4.5, FreeBSD 11 (currently 11-STABLE built on 22nd).

I have been having some issues with Samba. Performance has been good but load, even when its doing nothing useful has been extremely high. In top I'm getting 17-18% user time and 45% system time, 0 - 1% interrupts with smbd at 100%. 

I did a 5 second trace on the parent smbd process and got these results: 


```
syscall                     seconds   calls  errors
getcontext              0.000019265       4       0
fork                    2.221547074    5458       0
sendmsg                 0.075918559    5461       0
setreuid                0.055482378   10922       0
setregid                0.051755381   10923       0
setgroups               0.055463542   10923       0
__sysctl                0.057374873   10923       0
getgroups               0.058816533   10924       0
getegid                 0.122496351   27308       0
geteuid                 0.123087113   27307       0
write                   0.028582307    5423       0
wait4                   0.088445110   10473       0
sysarch                 0.000018445       4       0
sigreturn               0.026814389    5427      72
sigprocmask             0.080300391   16340       0
read                    0.016911240    3525       0
poll                    0.057053120    8983       0
close                   0.027361525    5459       0
accept                  0.032517063    5458       0
                      ------------- ------- -------
                        3.179964659  181245      72
```

With that in mind I set smbd max processes to a smallish number like 40 and the load disappears but naturally clients slowly stopped being able to connect. I set deadtime to 5 and then 1 minutes to match and made no difference. I've also tried Samba 4.2, 4.3, 4.4 with the same results if not slightly worse. 

The Samba logs don't seem to be particularly helpful as to determining if one or a handful of rogue clients are causing my issue. (Clients are primarily Linux machines with the kernel cifs client, mounted using mount -t cifs). 

I'm out of tricks and ideas so I'm open to anything.


----------



## DrJohnnyFever (May 25, 2017)

I have made some progress by forcing samba to never disconnect idle clients and remounting various machines. It seems like I was at this stage before with worse results. Anyway, the Linux cifs client does not handle samba disconnects very gracefully.


----------

