Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I own a personnal Fileserver, build on an AMD X2 platform, with an intel gigabit CT network adapter, running debian 6.0.

I've built a raid5 (2To x 3), shared by samba 3.5.6

From my desktop computer (windows7), when copying big files, sometimes the download/upload speed is steady around 55/60Mb/s, sometimes, it's really unstable, drops to from 1 or 2Mb/s, with a maximum of 20/30Mb/s, really unstable.

I've tested also using samba shares on raid and main disk, results are similar.

I've run some hdparm -tT on the server :

/dev/sda:
  Timing cached reads:   4698 MB in  2.00 seconds = 2349.11 MB/sec
  Timing buffered disk reads: 374 MB in  3.00 seconds = 124.49 MB/sec

/dev/md0:
 Timing cached reads:   4814 MB in  2.00 seconds = 2407.76 MB/sec
 Timing buffered disk reads: 640 MB in  3.00 seconds = 213.02 MB/sec 

Also, I've used iperf to test the bandwidth between the two computers :

iperf.exe -c pacem -n 1073741824 -fm
------------------------------------------------------------
Client connecting to pacem, TCP port 5001
TCP window size: 0.06 MByte (default)
------------------------------------------------------------
[  3] local 10.0.0.145 port 50913 connected with 10.0.0.37 port 5001
[ ID] Interval       Transfer     Bandwidth
[  3]  0.0-68.7 sec  1024 MBytes   125 Mbits/sec 

How can I proceed to find efficiently where the problem is ?

Thanks for reading!

share|improve this question
    
Running RAID5 on anything bigger than 1TB is asking for problems. I hope you don't keep anything critical on them or hope you have good backups. –  tombull89 Feb 25 '13 at 11:34
    
I have backups. What kind of problems ? Better solution than Raid5? Raid1 ? –  Obscur Moirage Feb 25 '13 at 13:44
    
With 3 disks, you don't really have much choice. I'd want to put another disk in and run a RAID10. Have a look at this SF question on different RAID levels, but RAID5 is a bad idea becuase, as mentioned in the link, The larger the drives in the RAID, the longer the rebuild will take, and the higher the chance for a second drive failure. –  tombull89 Feb 25 '13 at 13:50
    
R5 on large disks most commonly has problems with undetected data corruption. Spots on the disk go bad without the OS realizing it. Then during a rebuild the problems are all found, and data is lost. Scrubbing "fixes" this problem, if your system supports it. –  Chris S Feb 25 '13 at 13:51
    
Thanks for these interesting comments. You're surely right about the large drive question too, but if you do have backups, it's not so dangerous, is it? –  Obscur Moirage Feb 25 '13 at 14:16
show 2 more comments

1 Answer

up vote 3 down vote accepted

The problems you are describing are most likely due to three factors:

  1. socket options in the [global] section of your smb.conf file. A good baseline to start with is:

    socket options = IPTOS_THROUGHPUT TCP_NODELAY SO_KEEPALIVE
    

    See how that works; it's usually enough to get Samba "out of the way" for performance bottlenecks. For other options check out the Samba page; notably SO_SNDBUF and SO_RCVBUF. Setting these values incorrectly will affect performance negatively; this may take some trial and error.

  2. Making the aforementioned worse, the size of the files affects Samba. Small files have more overhead. And if you tune your socket options for bulk transfers you'll see small file speed get worse. Similarly tuning for tiny files makes large file transfers worse. Ideally you'll figure out what you transfer most often, or what makes the biggest differences to you (slow on a 4GB DVD ISO is usually more meaningful than slow on a 1KB file).

  3. DNS and VFS settings. If you don't have DNS forward and reverse mapping correctly configured you'll want to disable Samba's DNS lookups (dns proxy = no and hostname lookups = no). This is most evident when you first connect to a Samba share (if it takes longer than 5 seconds, this is the problem).

    There's a variety of VFS and related options that can be configured in Samba's [global] section. If they're wrong, Samba will have to deal with errors when opening/saving each file. The settings appropriate for your server will depend on it's filesystem, security, and some of the features you want enabled. There's no quick answer to this part, but it makes the least difference overall.

share|improve this answer
    
Many thanks for this detailled answer. 1/ I'll try to tune up my samba like you're proposing 2/ I understand clearly. The problem is that I store many different things on this server, with many different file size. I'll try to find a decent solution 3/ I'm pretty sure I've experienced this kind of slow first connection, so i'll try this first ! thanks a lot –  Obscur Moirage Feb 25 '13 at 14:22
    
this option in [global] seems to improve performance on big files socket options = IPTOS_THROUGHPUT TCP_NODELAY SO_KEEPALIVE –  Obscur Moirage Feb 25 '13 at 20:00
    
so I'll try this for some time, in order to test it in various situations (bulk of small files..) Thanks, i'll keep you updated ! –  Obscur Moirage Feb 25 '13 at 20:09
    
seems to work correctly, thanks –  Obscur Moirage Feb 26 '13 at 19:07
    
Unfortunately, I've experienced bad transfer rates again :( Not sure the problem is samba based.. –  Obscur Moirage Mar 1 '13 at 9:57
show 2 more comments

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.