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

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

Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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

DISCLAIMER - those are just thoughts - no guarantee ;)
portalabAuthor Commented:
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?
Gabriel OrozcoSolution ArchitectCommented:
Some things you need to keep in mind.

* You need to run benchmarks until you find the correct setting for your server

* FTP does not log. if you want full speed, turn off logging in samba
  log level = 0

* wide links must be set to yes so samba avoids many system calls. Also you can set up the buffer cache:

* make change notify to update less frequently so samba is not scanning the directory too often:

* Also one good line for options can be

* Use ReiserFS will improve up to 10x for small files reading/writing. you may want to test it. also remember to use "noatime" parameter in fstab so no access time need to be recorded each time samba looks for a file.

some options you already have them, but you can read these too:

hope this helps

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
portalabAuthor Commented:
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 :)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Networking

From novice to tech pro — start learning today.