Centos – Samba performance slow even on the smallest file

centosperformancesamba

I've setup Samba on my CentOS 5.5 server and its incredibly slow even to write a text file, talking like 5-10 seconds just to write an 8k file. I personally think its a miss configuration but not 100% sure. I run Apache, MySQL, tomcat and postfix off the server and they all run super fast. (It's just a personal server, next to no traffic)

Here is my config:

[global]
    workgroup = NONE
    server string = Laptop server
    preferred master = no
    local master = no
    domain master = no
    security = user
    passdb backend = tdbsam
    show add printer wizard = no
    load printers = no
    smb ports = 445
    hosts deny = ALL
    hosts allow = 10.0.
   log file = /var/log/samba/smbd.log
    log level = 2
    socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
    preserve case = yes
    short preserve case = yes
    unix extensions = no

I realise the log level is high but it's only been raised to try and diagnose, it made no difference when it was off.

I did notice in the logs that when I did save it opened a lot of files (about 50), I'm connecting to it from a Mac but I also connect to a similar config at work and its quite fast.

Sign in is very quick too. Any suggestions?

Best Answer

Does the server's network adapter happen to be a Realtek (especially RTL8111/8168B)? I've found that Realtek cards on Linux can be remarkably slow when used with Samba. The kernel driver source code had comments about Realtek's quality that provided a laugh unexpected from kernel comments.

From the server string, it appears the system is a laptop. That makes changing the NIC rather difficult, but you might try testing with the wireless or a USB network adapter. Wireless is of course not ideal for serving files with high performance, but in testing I bet it will beat 10 seconds for an 8k file.