- Linux:Powerful Server Administration
- Uday R. Sawant Oliver Pelz Jonathan Hobson William Leemans
- 468字
- 2021-07-09 18:16:58
Performance tuning the Samba server
In this recipe, we will look at Samba configuration parameters in order to get optimum performance out of your Samba installation.
Getting ready
You will need root access or an account with sudo
privileges.
It is assumed that you have installed the Samba server and it is properly working.
How to do it…
- Open the Samba configuration file located at
/etc/samba/smb.conf
:$ sudo vi /etc/samba/smb.conf
- Add or edit the following options under the
global
section of the configuration file:[global] log level = 1 socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=131072 SO_SNDBUF=131072 SO_KEEPALIVE read raw = Yes write raw = Yes strict locking = No oplocks = yes max xmit = 65535 dead time = 15 getwd cache = yes aio read size = 16384 aio write size = 16384 use sendfile = true
- Save the configuration file and restart the Samba service:
$ sudo service smbd restart
How it works…
The Samba server provides various configuration parameters. It uses TCP sockets to connect with clients and for data transfer. You should compare Samba's performance with similar TCP services such as FTP.
The preceding example lists some commonly used configuration options for Samba. Some of these options may work for you and some of them may not. The latest Samba version ships with default values for these options that work fairly well for common network conditions. As always, test these options one at a time or in a group, and benchmark each modification to get optimum performance.
The explanation for the preceding is as follows:
log level
: The default log level is set to0
. Samba produces a lot of debugging information and writing all this to disk is a slow operation. Increasing the log level results in increased logs and poor performance. Unless you are debugging the server, it is good to have the log level set to the lowest value.socket options
: These are the TCP/IP stack level options.read raw
andwrite raw
: These options enable Samba to use large read and writes to a network up to 64 KB in a single request. Some older clients may have issues with raw reads and writes. Check your setup before using these options.dead time
andso_keepalive
: These options set periodic checks for dead connections and close such connections and free unused memory.oplocks
: This allows clients to cache files locally and results in overall performance improvement. The default setting disablesoplocks
.aio read size
andaio write size
: This Asynchronous IO (AIO) allows Samba to read and write asynchronously when a file's size is bigger than the specified size values.
You can find various other options and respective explanations in the Samba manual pages. Use the following command to open the manual pages on your server:
$ man smbd
- 亮劍.NET:.NET深入體驗(yàn)與實(shí)戰(zhàn)精要
- 繪制進(jìn)程圖:可視化D++語(yǔ)言(第1冊(cè))
- 大數(shù)據(jù)戰(zhàn)爭(zhēng):人工智能時(shí)代不能不說(shuō)的事
- 輕松學(xué)Java Web開發(fā)
- Hands-On Data Science with SQL Server 2017
- ServiceNow Cookbook
- Hands-On Machine Learning with TensorFlow.js
- Visual C++編程全能詞典
- FPGA/CPLD應(yīng)用技術(shù)(Verilog語(yǔ)言版)
- 基于神經(jīng)網(wǎng)絡(luò)的監(jiān)督和半監(jiān)督學(xué)習(xí)方法與遙感圖像智能解譯
- Web編程基礎(chǔ)
- 機(jī)床電氣控制與PLC
- Raspberry Pi Projects for Kids
- Learning Couchbase
- Cisco UCS Cookbook