Slow writes, and even slower reads over Samba.


Recommended Posts

There've been many discussions in the past about what our bottlenecks are: whether it's the rotational disks, or whether it's the network, or the CPU, etc., etc..  In my particular case here though, it looks like Samba itself is the bottleneck:

 

I have one unRaid server, on which I've never been able to do better than 45MB/s writing and 30MB/s reading.  (It is also puzzling to me why reading from the server is slower than writing to it)

 

After troubleshooting everything but the phases of the Moon, it was clear to me that I need a more radical approach: a test without client PCs, without network adapters or cables, without hard disks.

 

For this test, we'll just use RamDisk on the server.

 

All network stuff disconnected, we'll do the test on the console of the unRaid server itself.

 

We'll share the RamDisk over Samba, and then we'll be clients to the Samba service from within the same computer.

 

(Stock unRaid 4.7, stock Samba, no addons, no modifications.)

 

Writing and reading directly to/from the ramdisk looks pretty reasonable:

root@Tower:~# dd if=/dev/zero  of=/dev/shm/test  bs=512k  count=400
400+0 records in
400+0 records out
209715200 bytes (210 MB) copied, 0.675903 s, 310 MB/s
root@Tower:~# 
root@Tower:~# dd if=/dev/shm/test  of=/dev/null  bs=512k
400+0 records in
400+0 records out
209715200 bytes (210 MB) copied, 0.366701 s, 572 MB/s

 

Now let's see how the same ramdisk does over samba.

Let's create a samba share for it.  In smb-extra.conf:

[ramdisk]
  path = /dev/shm
  read only = No

 

Mount that samba share locally, and do the same writing/reading:

root@Tower:~# mkdir /smb
root@Tower:~# mount.cifs  //127.0.0.1/ramdisk  /smb
root@Tower:~# 
root@Tower:~# dd if=/dev/zero  of=/smb/test  bs=512k  count=400
400+0 records in
400+0 records out
209715200 bytes (210 MB) copied, 4.83386 s, 43.4 MB/s
root@Tower:~# 
root@Tower:~# dd if=/smb/test  of=/dev/null  bs=512k
400+0 records in
400+0 records out
209715200 bytes (210 MB) copied, 6.74039 s, 31.1 MB/s

 

I can't believe the results I'm getting here!

Writing 43MB/s and readng 31MB/s from a RAMDISK is just not right.

Something is very wrong with samba on this server.

 

Can anybody reproduce these results?

 

(I am also getting the same results when testing with

newer samba versions, up to samba-3.5.10.)

 

BTW, the server CPU is 1GHz single core, and the RAM is 1GB.

(BIOS timings carefully checked, Memtest ran for days without a glitch)

The CPU load never goes more than 60% when writing to the samba share,

and the load never goes more than 15% when reading from it.

 

So, CPU, RAM, network, hard disks, all out of the equasion.

What's left?  Are there any other suspects that could exonerate Samba?

 

Funny thing, when testing with FTP, it's goes the other way around:

it writes ~80MB/s to the ramdisk, and reads ~138MB/s from it.

(similar setup as above, whithin the same machine, over 127.0.0.1)

 

Any ideas?

 

(syslog attached)

 

syslog.zip

Link to comment
  • 4 weeks later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.