Samba config / performance

Posted on 2006-05-22
Last Modified: 2008-03-06
Simple question. I want to know how I can specify the number of child processes samba spawns when it starts up? It seems to default to two and I wish to have more.

Here's why, for I might be pursuing the wrong solution here. I do a lot of work with this samba server, from multiple PCs. It seems to take forever when it initially connects and I think having more available would help this. I am assuming samba takes all connections from PC A under whatever process it initially connects to, which is why I suspect I may be wrong in my search. Most of my data is on the samba server, and when I finish some work, I move it to another share. This seems to drag everything else down because its a lot of data being copied and I can't seem to do much else when doing this. I have seen multiple child processes owned by the same user though which makes me suspect I can configure this to distribute the load over multiple. I have about 7 mapped drives to it and work from all constantly.

Any ideas? I hope that is enough information to go on. This really only started when I upgraded it from Fedora core 4 to 5 as well.

[root@persephone ewebster]# rpm -qa | grep samba
[root@persephone ewebster]# ps aufx | grep smb | grep -v grep
root      2010  0.0  0.1  12472  2224 ?        Ss   12:43   0:00 smbd -D
root      2013  0.0  0.0  12472  1000 ?        S    12:43   0:00  \_ smbd -D
ewebster  2224  0.2  0.2  13572  4188 ?        S    12:43   1:06  \_ smbd -D
root      2732  0.0  0.1  12904  3192 ?        S    14:33   0:00  \_ smbd -D
xbmc      4633  0.6  0.1  12904  2772 ?        S    21:35   0:00  \_ smbd -D
[root@persephone ewebster]#

Other devices do also use this server at the same time but not nearly as heavily as I do. And I am sure the hardware can handle what I'm doing. It has for some time now.
Question by:sophomERIC
    LVL 26

    Accepted Solution

    "It seems to take forever when it initially connects..."
    Sounds like a name resolution problem. Are you accessing this thing by ip address or some kind of name? (\\\share or \\servername\share or \\\share) If by name, is this name registered in DNS and WINS? Is the server on the same subnet as the clients?

    I don't think having having more processes will make the initial connection faster, it is probably not configured correctly. Can you reply with your smb.conf file? What are the specs of the machine?

    I think the performance when moving data between shares might be a result of the speed of your disk in the server and the network throughput. When you move data between shares, is it moving to different disks or just a different directory on the same disk? What kind of disks are we talking about (ata,sata,scsi), what about bus speed? What speed is the network connection to the server? What is the bandwidth utilization like on the server?

    I have a samba 3 server running on a 1GHz machine with 512MB at my school where shares are mapped on at least 200 different computers everyday all day. Students use the for shared storage to keep their work and really abuse it. It starts with the default of 2 processes and takes maybe 0.5 secs to map a drive or to bring up a share with \\\share. Sure it slows down when everyone starts hammering it mostly because it's using a 7200rpm parallel ATA disk. And has to struggle to keep up with all the read/writes.

    Author Comment

    I have it mapped using the host name, but my workstation is in the hosts file of the server. I didn't even think to try by IP. I will remap them and see what happens. These are all on the same subnet.

    [root@persephone ~]# cat /proc/cpuinfo
    vendor_id       : AuthenticAMD
    model name      : AMD Athlon(tm) XP 2500+
    cpu MHz         : 1833.556
    cache size      : 512 KB
    [root@persephone ~]# cat /proc/meminfo
    MemTotal:      2076272 kB

    The actual discs that this data is on is cluster of 4 Western Digital 250 GB sata drives in a raid 5 array on a 3ware Escalade 9000 raid controller. The hard should be able to handle it. Network does seem to be the likely culprit. This isn't a proper network anyways, just a workgroup config so there is no domain or local dns server, just a caching one.

    [root@persephone samba]# cat smb.conf | grep -v \# | grep -v \;

            Workgroup = Workgroup
            netbios name = Persephone
            smb ports = 139

            time server = yes
            wins support = yes

            server string = Fedora Core 5
            hosts allow = 192.168.50. 10.10.6.

        load printers = no
        printing = bsd
        printcap name = /dev/null
        disable spoolss = yes

           guest account = guest
            log file = /var/log/samba/%m.log

            max log size = 2000
            encrypt passwords = yes
            smb passwd file = /etc/samba/smbpasswd

            socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192

            remote browse sync =
            remote announce =

            local master = yes
            os level = 38
            domain master = yes
            preferred master = yes
            dns proxy = no

       invalid users = root
       status = yes
            idmap uid = 16777216-33554431
            idmap gid = 16777216-33554431
            template shell = /bin/false
            winbind use default domain = no
            username map = /etc/samba/smbusers
            guest ok = yes

    Socket options is my best guess at what to try config wise, but I don't really know what else to try in place of it.
    LVL 26

    Expert Comment

    Looks like Samba is setup as a wins server...does each workstation have this ip set as the wins server?

    "I have it mapped using the host name, but my workstation is in the hosts file of the server..."

    Since this is a workgroup with no authoritative dns you might want to make sure the server's name (persephone) is in the CLIENT'S hosts files, since the client will be initiating the communication with the server. On XP the hosts file is located at c:\WINDOWS\system32\drivers\etc\hosts and has the same syntax as the linux vesion. Since the computers are probably trying to resolve the name in DNS first and timing out (since it is only a resolver for internet names), putting that name in the hosts file should speed up the initial connection.

    Author Comment

    It does appear to have just been that it was mapped by host name instead of IP. I forgot it used to be in the hosts file, but this workstation was recently reimaged with a different image than the last. It was supposed to be a similar image but apparantly I overlooked the hosts file on this one. Thanks for you help.

    I would still be curious as to how to specify the number of smb child processes if you happen to know, simply out of curiousity.
    LVL 26

    Expert Comment

    Glad it's working better for you now.

    I looked through the man page for smb.conf and the only thing related to the number of processes is the "max smbd processes" directive, which is set to unlimited by default. I don't think there is a way of specifying more than 2 processes at startup. Smbd will start more as it needs them, so I don't think it's something you should worry about either.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    I have seen several blogs and forum entries elsewhere state that because NTFS volumes do not support linux ownership or permissions, they cannot be used for anonymous ftp upload through the vsftpd program.   IT can be done and here's how to get i…
    Note: for this to work properly you need to use a Cross-Over network cable. 1. Connect both servers S1 and S2 on the second network slots respectively. Note that you can use the 1st slots but usually these would be occupied by the Service Provide…
    Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
    Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

    754 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now