Linux – Samba Read Performance

linuxperformancesamba

Whenever I read a large file from my Samba server I get around 40 MB/sec transfer rate. If I read the very same file again, the speed is all of a sudden bumped up to 70 MB/sec.

Why do I not get 70 MB/sec the first time around? The disks easily perform up to 95 MB/sec. Does Samba have to cache the entire file in RAM to get performance or something?

When writing files to the server I get 95+ MB/sec every time, quite the difference.

I have tried setting some socket options (TCP_NODELAY IPTOS_LOWDELAY SO_SNDBUF=65535 SO_RCVBUF=65535), but they don't seem to do much to help.

So, any tips on how to improve read performance in Samba?

Note: The disks are 2x1TB Samsung Spinpoint F1 7200 RPM configured in software RAID 1.

Update: It seems the client had as much, if not more, to do with this issue as the server. I was using my trusty old Total Commander, which seems to be too old these days. When I copy files using Windows Explorer instead, even uncached files are read pretty fast. Thanks for your help.

Best Answer

Till now all answer are more related to the discs than to the RAID configuration. Maybe question 19 and 4 of this guide can help you: Software RAID HOWTO.

Another thing is the network side. Do you have TOE enabled on your NIC?

And the last thing: Did you check that your bottleneck is not on the client side? It could be that your FTP client is keeping more data in the RAM than the CIFS service does. And that's maybe one reason why FTP is faster.