Make Samba Go Faster

Background

Amahi makes heavy use of Samba. Samba is what handles shared folders and allow you to connect to your Amahi and browse your folders from Windows etc. Greyhole also uses Samba and it’s logs to handle file operations.

After installing a wired gigabit network in my house, due to the WIFI being bogged down by 14 wireless clients, I tested the performance in the network. I got around 500-600MBit/sec in read speeds and about 600-700MBit/sec in write speeds. But when I tried against the Amahi server I found that I only got 56MBit/sec in read speeds.

After looking at the samba configuration file I saw that Async IO (AIO) was not enabled by Amahi. What AIO does is that it let’s Samba handle several file operations asynchronously. This can, at the expense of some CPU cycles, increase the performance quite a lot.

I increased the read speed to 500-600MBit/sec by enabling AIO and saw Samba using around 1-4% CPU on a Intel E2200.

Enable AIO

To enable AIO an you can add the following to the global section of your /etc/samba/smb.conf file

Text

​socket options=SO_RCVBUF=131072 SO_SNDBUF=131072 TCP_NODELAY

min receivefile size = 16384
use sendfile = true
aio read size = 16384
aio write size = 16384
aio write behind = true <— NOTE!!!: Only use with extreme caution. Read explanation below​

This is only an example but you can tweak all the options to fit your environment and needs. Bellow are an explination of the options used above. More information can be found at http://www.samba.org

 

https://wiki.amahi.org/index.php/Make_Samba_Go_Faster

Join the Conversation

2 Comments

Leave a comment