Performance Tuning

From SambaWiki
Revision as of 15:37, 10 February 2017 by Mmuehlfeld (talk | contribs) (Rewrote page.)


In certain situations, users can have performance problems when accessing a Samba server. In most cases, incorrectly set parameters cause the performance problems, such as described in Settings That Should Not Be Set.

If you are having performance problems using Samba that you cannot solve, subscribe to the Samba mailing list and post:

  • A description of the problem.
  • You complete smb.conf file without any modifications.
  • Details about your environment:
  • Operating system and version
  • Samba version
  • Is Samba built by yourself or are you using packages? If using packages, who is the package creator?
  • Type of the installation: Active Directory (AD) domain controller (DC), NT4 primary domain controller (PDC), AD or NT4 domain member, standalone installation.

SMB Protocol Version

Each new server message block (SMB) version adds new protocol features and improves performance. Additionally, recent Windows operating systems support the latest protocol versions. If a new SMB protocol version is implemented in Samba and considered stable, the default of the server max protocol parameter is set to the latest version. It is recommended that you do not set the server max protocol parameter in your smb.conf file. If the parameter is not set and you are updating Samba to a version that provides a new SMB protocol version, it is automatically available to the clients.

To unset the parameter, remove the server max protocol entry from the [global] section of your smb.conf file.

Directories with a Large Number of Files

To improve the performance of shares that are having directories containing more than 100.000 files:

  • Rename all files on the share to lowercase.
  • Set the following parameters in the share's section:
case sensitive = true
default case = lower
preserve case = no
short preserve case = no
  • Reload Samba:
# smbcontrol all reload-config

Using these settings, all new files on the share are created using lowercase. Samba no longer has to scan the directory for upper- and lowercase. This improves the performance. For further details about the parameters, see the descriptions in the smb.conf(5) man page.

Settings That Should Not Be Set

The socket options Parameter

Modern UNIX operating systems are tuned for high network performance by default. For example, Linux has an auto-tuning mechanism for buffer sizes. When you set the socket options parameter in the smb.conf file, you are overriding these settings. In most cases, setting this parameter decreases the performance.

To unset the parameter, remove the socket options entry from the [global] section of your smb.conf file.