Link to home
Start Free TrialLog in
Avatar of portalab
portalab

asked on

Tweaking a samba based NAS for gbit

I recently built a NAS box with the amition to allow it to serve the SMB network lightning fast.
The server itsefl is capable of delivering excellent speeds, for example FTP transfers goes up to 80-90mb/s.

However the samba speeds never goes past ~30mb/s and I've spent quite some time trying to optimize this.
There is plenty of available resources in the server, so huge buffers etc is not a problem.

The OS is running Ubuntu 2.6.22-14-server with the stock kernel. No extra TCP/IP tweaks are made.
The NIC is a Intel Corporation 82545GM Gigabit Ethernet Controller (rev 04).
Jumbo Frames is turned off for the moment, speed acctually decrease when I turn it on.

How can I make samba faster?

My current samba optimization settings as following

socket options = TCP_NODELAY IPTOS_LOWDELAY 
read raw = yes                     # Default 
write raw = yes                    # Default 
oplocks = yes                      # Default 
max xmit = 65535                   # Default 
dead time = 15                     # Default is 0
getwd cache = yes
lpq cache = 30

Open in new window

Avatar of ravenpl
ravenpl
Flag of Poland image

try fiddling with net values in /etc/sysctl.conf, issue sysctl -p after each change

# increase TCP max buffer size # default 131071
net.core.rmem_max = 524288
net.core.wmem_max = 524288
# default 110592
net.core.rmem_default = 262144
net.core.wmem_default = 262144
# increase Linux autotuning TCP buffer limits
# default 4096    87380   174760
net.ipv4.tcp_rmem = 4096 262144 524288
# default 4096    16384   131072
net.ipv4.tcp_wmem = 4096 262144 524288
# increase backlog # default 300 or 1000
net.core.netdev_max_backlog = 2500

also, for smb socket options, don't forget about buffers, try even larger than the below
socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=8192 SO_SNDBUF=8192

DISCLAIMER - those are just thoughts - no guarantee ;)
Avatar of portalab
portalab

ASKER

Tried these settings:

echo "2097136" > /proc/sys/net/core/rmem_max
echo "1048560" > /proc/sys/net/core/rmem_default
echo "2097136" > /proc/sys/net/core/wmem_max
echo "1048560" > /proc/sys/net/core/wmem_default
echo "65536 1398080 2796160" > /proc/sys/net/ipv4/tcp_rmem
echo "65536 1398080 2796160" > /proc/sys/net/ipv4/tcp_wmem
echo "3129344 3137536 3145728" > /proc/sys/net/ipv4/tcp_mem
echo "32768" > /proc/sys/net/ipv4/tcp_max_orphans
echo "163840" > /proc/sys/net/core/optmem_max
sysctl -w net.ipv4.tcp_window_scaling=1
echo 1 > /proc/sys/net/ipv4/tcp_timestamps
echo 1 > /proc/sys/net/ipv4/tcp_sack
sysctl -w net.ipv4.route.flush=1
ifconfig eth0 txqueuelen 1000
sysctl -w net.core.netdev_max_backlog=2500

And then trying different RSIZE and WSIZE values, but speeds never went up.

But like I said in the original post FTP is very fast as it is, so tweaking in the TCP/IP layer shouldnt be needed. Is Samba just a slow protocol? Anybody acctually got speeds from samba close to FTP speeds?
ASKER CERTIFIED SOLUTION
Avatar of Gabriel Orozco
Gabriel Orozco
Flag of Mexico image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Alot of good ideas, sadly none of them gave any real improvement. I guess the SMB protocol is simply too limited. Time to try iSCSI or something similar :)