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 recently set up a samba server on a ubuntu desktop to serve a shared directory to another four ubuntu desktops. They are in a Giga-bit LAN. I am getting crappy performance from it and I am feeling neither disk nor network is saturated. I suspect there must be some tuning I can do..

The samba server serves a couple dozen directories with big files ( about 100MB each). Then I have four jobs running on each client machine, reading those files intensively. So 16 jobs total. The jobs should have CPU usage close to 100%. But with this samba setup, their cpu usage is very bursty and in many cases very low. Here is the iostat -x 5 output from the server.

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               5.60     1.20  148.00    0.60 19532.00     7.20   262.98     9.74   65.91   65.71  113.33   6.73 100.00
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.60    0.00    3.20   23.40    0.00   72.80
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               4.40     2.80  165.00    0.60 21676.00    13.60   261.95     9.24   56.11   55.98   92.00   6.04 100.00
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.30    0.00    2.51   24.71    0.00   72.48
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               3.40     1.80  149.40    0.40 19120.00     8.80   255.39     9.22   61.09   60.92  128.00   6.68 100.00
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.30    0.00    2.34   27.67    0.00   69.69
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               3.00     0.00  135.60    0.00 17572.80     0.00   259.19    12.07   86.05   86.05    0.00   7.37 100.00
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.55    0.00    2.81   22.01    0.00   74.64
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.00  145.40    0.00 18588.00     0.00   255.68    12.12   85.74   85.74    0.00   6.88 100.08
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.25    0.00    2.79   22.49    0.00   74.46
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.00  134.20    0.00 17074.40     0.00   254.46    12.42   92.88   92.88    0.00   7.45 100.00
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.50    0.00    2.77   25.21    0.00   71.51
Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               1.20     0.00  141.20    0.00 18042.40     0.00   255.56    12.12   85.68   85.68    0.00   7.08 100.00
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.25    0.00    2.89   22.40    0.00   74.46

So the disk read throughput is only less than 20MB/s. I think the disk could achieve at least 50-60MB/s read throughput. How could I debug this further? Could this be a network problem? Or a samba setup problem?

EDIT: I noticed the %util number from iostat is already 100%, and %iowait is more than 20%. So it means the disk is already saturated? but only achieves 20MB/s read throughput? How could I interpret the iostat numbers and optimize my system properly?

share|improve this question
    
What file system is being served over Samba? Is it ext3/4? Or a separate disk running NTFS? Also what sort of hardware? Sata? –  webtoe Mar 20 '12 at 15:29
add comment

1 Answer

I think this is more of an expectation issue than an actual issue. With 16 jobs running concurrently on a what I'm going to assume is a single consumer grade SATA drive in this desktop I'd say 20MB/s is respectable.

Looking at your iostat output you can see that there are about 150ish read IOPs happening and that's about all you'll get out of a 7200 RPM SATA drive.

share|improve this answer
    
In ideal conditions, even. 7200rpm means 120 hard physical IOPS, and you'll only reach higher read operations when the drive's caching is actively helping - not in a majority of cases :) On the average, <100 IOPS is a realistic figure for consumer SATA drives. –  adaptr Mar 20 '12 at 14:44
    
I see. Thanks a lot. But is there a way to ask samba to read a big block of data every time so that it gets more data back for each IOP? Those jobs will read each file sequentially, is there a way to optimize that? –  agmao Mar 20 '12 at 15:51
    
Ok, I tried blockdev --setra from default value 256 to a big number like 2048. It seems helping the read throughput a lot. Now the read throughput is much higher than 20MB/s, swining between 30MB/s and 60MB/s. –  agmao Mar 20 '12 at 16:14
add comment

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.