advert

Saturday, 28 August 2010

FreeBSD 9.0-CURRENT and SLOW Samba version 3.0.37

In this part:

- standard SMB instalation
- slow read and write sorted
- example smb.conf




1. Installing samba:

cd /usr/ports/net/samba3; make install clean

- copy and adjust the configuration details:
cp /usr/local/etc/smb.conf.sample /usr/local/etc/smb.conf

check your configuration:
testparm 

In my case samba was very slow with a speed around 1,3 Mbyte/s.
- sftp copy has had speen around 6 Mbyte/s

Old server with 32-bit FreeBSD 6.4 and Samba 2.7 has had speed 22 Mbytes/s with Intel(R) PRO/1000 Network cards.


After some research I found that I need AIO_SUPPORT and slightly adjust my configuration.

2. Improving speed

AIO_SUPPORT:
kldload aio

and add this line to /boot/loader.conf
aio_load="YES"

3. Adding those lines to smb.conf

socket options=SO_RCVBUF=131072 SO_SNDBUF=131072 TCP_NODELAY IPTOS_LOWDELAY
use sendfile=true
aio read size = 16384
aio write size = 16384
aio write behind = true


4. samba configuration file (example smb.conf)

[root@server ~]# testparm
Load smb config files from /usr/local/etc/smb.conf
Processing section "[homes]"
Processing section "[netlogon]"
Processing section "[profiles]"
Processing section "[printers]"
Processing section "[share_1]"
Processing section "[share_2]"

Loaded services file OK.
Server role: ROLE_DOMAIN_PDC
Press enter to see a dump of your service definitions
[global]
        dos charset = ISO8859-2
        display charset = UTF-8
        workgroup = MORPHEUS
        server string = Home Server %v
        interfaces = 192.168.1.7/24
        bind interfaces only = Yes
        passdb backend = tdbsam
        log file = /var/log/samba/log.%m
        max log size = 5
        socket options = SO_RCVBUF=131072 SO_SNDBUF=131072 TCP_NODELAY IPTOS_LOWDELAY

        load printers = No
        printcap name = lpstat
        add user script = /usr/sbin/useradd %u
        delete user script = /usr/sbin/userdel %u
        add group script = /usr/sbin/groupadd %g
        delete group script = /usr/sbin/groupdel %g
        delete user from group script = /usr/sbin/deluser %u %g
        add machine script = /usr/sbin/adduser -n -g machines -c Machine -d /dev/null -s /bin/false %u
        logon script = logon.bat
        logon path = \\%L\profiles\%u\%m
        domain logons = Yes
        os level = 75
        preferred master = Yes
        domain master = Yes
        dns proxy = No
        wins support = Yes
        hosts allow = 192.168.1., 192.168.2., 127.
        aio read size = 16384
        aio write size = 16384
        aio write behind = true
        use sendfile = Yes
        map archive = No
        store dos attributes = Yes

[homes]
        comment = Home Directories
        read only = No
        browseable = No

[netlogon]
        comment = Network Logon Service
        path = /usr/local/samba/lib/netlogon
        guest ok = Yes
        share modes = No

[profiles]
        path = /usr/local/samba/profiles
        read only = No
        create mask = 0600
        directory mask = 0700
        guest ok = Yes
        browseable = No

[printers]
        comment = All Printers
        path = /var/spool/samba
        read only = No
        guest ok = Yes
        hosts allow = 192.168.0., 192.168.1., 192.168.2., 127
        printable = Yes
        browseable = No

[share_1]
        comment = Mary's and Fred's stuff
        path = /sys
        valid users = mary, fred
        read only = No
        create mask = 0765

[share_2]
        comment = Film's stuff
        path = /mnt/buG4ME76naW
        valid users = mary, fred
        read only = No
        create mask = 0765




Now is Samba File Server quicker - 8,7 Mbytes/s instead of 1,3 Mbyte/s.
There is not set up printing at this example.
Next upgrade will be slow data switch with new Intel(R) PRO/1000 Network card. I am expecting speed is around 22 Mbyte/s or 1GB file/min.





References: 
forums.freebsd.org
http://www.samba.org

PS. I did try change sysctl with recomended values and had bit slower connection.