Performance Tuning Parameters
This section outlines the parameters available for tuning the performance of Fusion. While some parameters have a direct and predictable impact on system performance, others may require experimentation to achieve best results. Additionally, certain parameters may affect system stability, client application's behavior, or other operational aspects. Therefore, any modifications to these settings in production environments should only be made with careful consideration and after thorough testing.
Windows 11 24H2 was officially released on October 1, 2024 and requires signing by default. This may negatively impact performance which is expected and is not Fusion SMB specific behavior. If you need performance over security, simply disable SMB signing requirement on Windows clients. Please see: https://learn.microsoft.com/en-us/windows-server/storage/file-server/smb-signing?tabs=group-policy#disable-smb-signing
System Resources
This section covers parameters related to system resources, such as the number of open files, concurrent network connections, and active threads in the Fusion SMB process, all of which impact RAM usage.
Network Connections
Maximum Number of Client Connections
To increase or decrease the maximum number of client connections, set the connections_max parameter:
- Configuration file's
[global]section:connections_max tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
Value Type: integer
Value Format: <connections>
<connections> specifies the maximum number of concurrent client connections allowed to the server. Once the limit is reached, new connections will be rejected. A value of 0 allows for an unlimited number of connections, constrained only by the available system resources.
Default Value: 1024
The connections_max parameter in conjunction with the open_files_max parameter, controls the maximum number of open file descriptors Fusion SMB can consume. It is critical to keep the combined total of these two parameters within the system's limit. Misconfiguration may result in the server process crashing.
Maximum Number of Sessions
To configure the maximum number of client sessions, use the sessions_max parameter:
- Configuration file's
[global]section:sessions_max tsmb-cfg global update:--sessions-maxtsmb-cfg global addandtsmb-cfg global del: Not supported
Value Type: integer
Value Format: <sessions>
<sessions> specifies the maximum number of client sessions that can be active on the server at any given time. A value of 0 indicates an unlimited number of sessions.
Default Value: 0.
Multichannel
Fusion SMB supports multichannel connections for client sessions. For more information see Multichannel.
File Descriptors
The following parameters control the number of file descriptors consumed by Fusion SMB.
If clients encounter errors when attempting to open files (e.g., STATUS_TOO_MANY_OPENED_FILES on Windows, or ENFILE or EMFILE on Linux/macOS), consider increasing the values of these parameters for raising the system's limit on open files.
Maximum Number of Open Files
To set the maximum number of open files, adjust the open_files_max parameter:
- Configuration file's
[global]section:open_files_max tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
Value Type: integer
Value Format: <files>
<files> specifies the number of files that can be kept open simultaneously by the server across all client sessions. The minimum value is 1024. A value of 0 indicates that the server will use the system's default value (i.e., the value in /proc/sys/fs/nr_open).
Default Value: 8192
Setting this parameter to a high value on devices with limited RAM may cause significant memory fragmentation, potentially triggering the Out of Memory (OOM) killer.
The connections_max parameter in conjunction with the open_files_max parameter, controls the maximum number of open file descriptors that Fusion SMB can consume. It is critical to keep the sum of these parameters below the system's limit. Misconfiguration may result in the server process crashing.
Maximum Number of Open Files per Session
To set the maximum number of open files per session, adjust the sess_open_files_max parameter:
- Configuration file's
[global]section:sess_open_files_max tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
Value Type: integer
Value Format: <sessions>
The maximum number of open files per session. 0 indicates that the maximum number of open files is unlimited.
Default Value: 1024
The sess_open_files_max parameter must be set to a value lower than the value of open-files-max. If it is set to a higher value, a warning will be displayed, and the parameter will automatically revert to its default value of 1024.
Network Threads
To set the maximum number of network threads, use the transport_rx_threads and transport_tx_threads parameters:
- Configuration file's
[global]section:transport_rx_threads tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
Value Type: integer
Value Format: <threads>
<threads> specifies the number of transport threads used for receiving data from clients. A value of 0 indicates that the data from packets will be read in the context of the kernel's io_mux threads.
Default Value: 0
- Configuration file's
[global]section:transport_tx_threads tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
Value Type: integer
Value Format: <threads>
<threads> specifies the number of transport threads used for sending data to clients.
Default Value: 1
VFS Behavior
The Virtual File System (VFS) layer in Linux manages file access for all applications, including Fusion SMB. Tuning the interaction between Fusion SMB and VFS can greatly enhance system performance.
VFS Data and Metadata Threads
Global VFS Thread Pool
The global VFS thread pool controls the number of threads used to handle data and metadata operations for shares without a dedicated VFS thread pool.
To set the global VFS thread pool, adjust the vfs_data_threads and vfs_metadata_threads parameters:
- Configuration file's
[global]section:vfs_metadata_threads tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
vfs_metadata_threadsValue Type: integer
Value Format: <threads>
<threads> specifies the number of threads for VFS metadata operations in the global pool (i.e., shared between all shares without a dedicated pool). If set to 0, metadata operations will share the same thread pool as data operations, as specified in the vfs_data_threads parameter.
Default Value: 1
- Configuration file's
[global]section:vfs_data_threads tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
vfs_data_threadsValue Type: integer
Value Format: <threads>
<threads> specifies the number of threads for VFS data operations in the global pool (shared across all shares without a dedicated pool). If set to 0, data operations will use the same thread pool as metadata operations, as specified by the vfs_metadata_threads parameter.
Default Value: 1
It is strongly recommended not to leave vfs_data_threads at the default value of 1. Adjust it to a higher value based on workload requirements.
Additionally, experimentation is advised to determine the optimal values for vfs_data_threads and vfs_metadata_threads for your workload.
Global VFS Data Queues
When vfs_data_threads and vfs_metadata_threads are both non-zero, data and metadata operations run on separate thread pools. The data threads take their work from a single shared queue by default, which can become a point of contention once the request rate is high enough.
The vfs_data_queues parameter splits the data thread pool into several queues. Each queue is served by its own subset of the data threads, and data (read and write) requests are distributed over the queues, so the threads of the pool contend with each other less:
- Configuration file's
[global]section:vfs_data_queues tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
vfs_data_queuesValue Type: integer
Value Format: <queues>
<queues> specifies the number of queues the global pool of VFS data threads is split into. Each queue is served by its own subset of the threads configured with vfs_data_threads, and data (read and write) requests are distributed over the queues. More queues reduce contention between the threads of the pool when the request rate is high.
Default Value: 1
Per-Share VFS Thread Pool
To optimize performance based on each share's specific usage patterns and requirements, you can configure a dedicated VFS thread pool for individual shares:
A share with a dedicated thread pool can also split its data threads into several queues, in the same way as the global pool:
As with the global VFS thread pool, if a specific share requires a dedicated VFS thread pool, experiment with the number of threads to determine the optimal configuration for your workload.
Zero-Copy
Zero-copy enhances data transfer performance by minimizing the number of memory copies and system calls. Fusion SMB leverages zero-copy on client read operations by retrieving data from the file system page cache and uses zero-copy to send it directly to the network socket buffer.
Regardless of the setting, zero-copy is disabled for all SMB messages that are compound, signed, or encrypted.
The impact of zero-copy on performance varies depending on the workload and underlying storage. It is recommended to evaluate and test this setting within the context of your specific workload.
Toggling Per-Share Zero-Copy Behavior
To control the zero-copy behavior on a per-share basis by setting the vfs_zerocopy_write and vfs_zerocopy_read parameters in the share configuration:
Synchronous I/O and Forced Buffering
To force Fusion SMB to perform synchronous I/O, or to force buffering of write operations into the page cache, regardless of the client's request, adjust the vfs parameter on a per-share basis:
File Space Preallocation
For workloads that benefit from preallocated file space, you can configure Fusion SMB to preallocate space on the underlying storage using the fallocate() system call.
To enable preallocations on a per-share basis, set the vfs_fallocate_min and vfs_fallocate_max parameters on a share. These parameters define the file size range for which space should be preallocated.
SMB Behavior
The following parameters can impact the performance of Fusion SMB by adjusting its behavior within the context of SMB protocol.
Maximum Number of Shares
To limit the number of shares that can be created, set the shares_max parameter:
- Configuration file's
[global]section:shares_max tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
Value Type: integer
Value Format: <shares>
Specifies the maximum number of shares that can be configured on the server, including both administrative and user shares.
Default Value: 1048576
Case Insensitivity
In Windows environments, file operations are case-insensitive by default, meaning the file system does not differentiate between uppercase and lowercase characters in file or directory names. For example, MyFile.txt is treated the same as myfile.txt.
However, on Linux–where Fusion SMB operates–file operations are inherently case-sensitive. Hence, file operations on Fusion SMB are case-sensitive by default. For use cases that require case-insensitive operations, you can modify this behavior. Case sensitivity can be controlled globally, or overridden on a per-share basis.
When configured to be case-insensitive, Fusion SMB first attempts to rely on the underlying file system's support for case-insensitive file name resolution. However, if not supported by the file system, Fusion SMB will fall back on performing a case-insensitive comparison of the file name against all the files in the directory.
Enabling case-insensitivity can introduce a significant overhead, especially on file systems that don't natively support it, or on large datasets and complex directory trees.
To control case insensitivity, set the case_insensitive parameter, both globally and on a per-share basis:
- Configuration file's
[global]section:case_insensitive tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
case_insensitiveValue Type: boolean
Value Format: true|false
true: Makes file operations case-insensitive by default.false: Leaves file operations case-sensitive by default.
Default Value: false
Opportunistic Locking
Opportunistic locks (oplocks) enable a client to cache file data locally, boosting performance by reducing the frequency of message exchanges between the client and server. With an oplock obtained, the client can perform certain operations on the file locally without immediately notifying the server, thereby minimizing network traffic.
If another client attempts to access the same file, the server revokes the oplock, prompting the original client to flush its cached data to the server to maintain data consistency.
Oplocks improve performance in single-client scenarios while ensuring data integrity in multi-client environments.
In scale-out configuration oplock states are coordinated cluster-wide, maintaining cache coherency across the cluster. This synchronization preserves data integrity and prevents inconsistencies or corruption during disruptions, including failovers or transient network interruptions.
Global Oplock Behavior
To control the global oplock behavior, set the oplock parameter:
- Configuration file's
[global]section:oplock tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
oplockValue Type: string
Value Format: <type>
<type> specifies the type of opportunistic lock to be issued:
all: Full oplock/lease support.disabled: Disables oplock/lease support. This prevents the server from advertising the SMB2_GLOBAL_CAP_LEASING capability to clients.none: Enables oplock/lease support and advertises the SMB2_GLOBAL_CAP_LEASING capability to clients. However, Fusion SMB server only grants NONE oplock/lease regardless of the value of RequestedOplockLevel.exclusive: Similar toall, however only one oplock can be granted on a file at a time. Multiple clients can access a file, as long as there are no oplocks on it, or all clients have the same lease key.
Default Value: all
Controlling the Type of Oplocks Issued for a Share
You can configure the type of opportunistic locks (oplocks) issued by Fusion SMB, restricting them to Level 2 (read-only) oplocks, or disabling them entirely.
Restricting oplocks to read-only can be useful for read-heavy workloads, as it improves performance by minimizing the need for oplock revocations.
SMB2 Credits
To control the number of credits that are issued to clients, set the smb2_credits_max parameter:
- Configuration file's
[global]section:smb2_credits_max tsmb-cfg global update:--smb2-credits-maxtsmb-cfg global addandtsmb-cfg global del: Not supported
Value Type: integer
Value Format: <credits>
<credits> specifies the maximum amount of credits the server will advertise to clients.
Default Value: 8092
Message Size Limits
To control the maximum size of SMB messages advertised to clients, set the smb2_read_max, smb2_write_max, and smb2_trans_max parameters:
- Configuration file's
[global]section:smb2_read_max tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
Value Type: integer
Value Format: <bytes>
<bytes> specifies the maximum data size the server can return in a single READ operation to the client. The maximum value is determined by the SMB dialect being used.
Default Value:
- Configuration file's
[global]section:smb2_write_max tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
Value Type: integer
Value Format: <bytes>
Where <bytes> will be used to communicate to the client the maximum data size the server will accept in a single WRITE operation. The maximum value is determined by the SMB dialect being used.
Default Value:
- Configuration file's
[global]section:smb2_trans_max tsmb-cfg global update: Not supportedtsmb-cfg global addandtsmb-cfg global del: Not supported
Value Type: integer
Value Format: <bytes>
<bytes> specifies the maximum buffer size that may be used for QUERY, SET, and NOTIFY operations. This value is communicated to the client. The maximum value is determined by the SMB dialect in use.
Default Value:
NFS Behavior
The following parameters and techniques tune Fusion NFS. The sections above with an NFS badge also apply to Fusion NFS.
As with any tuning, benchmark your end-to-end system before and after a change, for example with fio and iperf.
Protocol Threads
The protocol_threads global parameter sets the number of threads that process NFS requests.
[global]
protocol_threads = 4
[/global]
- Default:
1. Fusion NFS limits the value to the number of online CPUs, up to128. - Recommended:
4–12. In Tuxera's testing, values above12lowered the performance of large I/O, and values below4lowered the performance of small I/O.- For I/O sizes of 512 KiB or larger, start at
12and do not usually go higher. - For I/O sizes of 128 KiB or smaller, start at
4and do not usually go lower.
- For I/O sizes of 512 KiB or larger, start at
The best value depends on your hardware, network and workload. Benchmark your workload with several values in the recommended range, and keep the value with the best result.
RPC over RDMA
On networks with RDMA support (RoCEv2 or InfiniBand), NFS over RPC-over-RDMA lowers the CPU load and the latency of workloads with high throughput. Enable the RDMA listener on the server. Then mount the export on the Linux kernel NFS client with proto=rdma and the port of the RDMA listener.
sudo mount -t nfs4 -o vers=4.1,proto=rdma,port=20049 <server>:/export /mnt/nfs
Client connection trunking
An NFSv4.1 client can use several connections for one session. This is session trunking.
The Linux kernel NFS client opens several connections to the server address in the mount command with the nconnect mount option (1 to 16). These connections increase throughput.
sudo mount -t nfs4 -o vers=4.1,nconnect=8 <server>:/export /mnt/nfs
To add connections to other server addresses, give the server several IP addresses. The addresses can be on one network interface or on several interfaces. Then mount the same export once through each address. The client detects that each address belongs to the same server, and adds one connection to that address to the existing session. The client sends the requests in turn on all connections of the session.
Set nconnect and max_connect on the first mount. The client ignores both options on later mounts. The max_connect option sets the maximum number of server addresses in the session (1 to 16, default 1). The session then has nconnect connections to the first address and one connection to each additional address. The max_connect option is available in Linux 5.15 and later.
sudo mount -t nfs4 -o vers=4.1,nconnect=4,max_connect=16 <server-address-1>:/export /mnt/nfs
sudo mount -t nfs4 -o vers=4.1,nconnect=4,max_connect=16 <server-address-2>:/export /mnt/nfs
sudo mount -t nfs4 -o vers=4.1,nconnect=4,max_connect=16 <server-address-3>:/export /mnt/nfs
In this example, the session has 4 connections to the first address and 1 connection to each of the 2 other addresses.
Fusion NFS does not support trunking discovery in this release. The trunkdiscovery mount option does not find additional server addresses, so mount each address separately.
Buffered I/O
Fusion NFS reads and writes through the page cache of the server for every NFS request. The NFS protocol does not have a field for unbuffered I/O, so a client cannot request direct I/O on the server.
Your data safety does not depend on direct I/O. When the NFS client sends a stable WRITE, the server writes the data to disk before it sends the reply. When the NFS client sends a COMMIT, the server writes the earlier unstable WRITEs to disk.
For benchmarks, use direct I/O on the client, for example --direct=1 in fio. Otherwise, the page cache of the client affects your results.
NUMA pinning
On a server with several CPU sockets, each socket has its own memory, called a NUMA node. Access to the memory of another node is slower than access to local memory. Each network interface also connects to one node.
Throughput is best when the server threads, the interface interrupts and their memory are on the node of the network interface. To find that node and its CPUs, run these commands:
cat /sys/class/net/<nic>/device/numa_node
cat /sys/devices/system/node/node<node>/cpulist
The first command prints the node number. The second command prints the CPUs of that node. If the first command prints -1, the server has one NUMA node or does not report the node of the interface. Pinning then does not change performance.
To pin the server to the node, add a drop-in file to the tsmb-server service. The NUMAPolicy and NUMAMask settings need systemd 243 or later.
sudo systemctl edit tsmb-server.service
[Service]
CPUAffinity=<cpulist>
NUMAPolicy=preferred
NUMAMask=<node>
With NUMAPolicy=preferred, the kernel allocates the memory of the server on that node. When the node is full, the kernel uses the other nodes. Then restart the service with sudo systemctl restart tsmb-server.service.
To start the server from the command line with the same pinning, run tsmb-server through numactl. The numactl command is in the numactl package.
sudo numactl --cpunodebind=<node> --preferred=<node> -- tsmb-server -c /etc/tsmb.conf
The --cpunodebind option runs the server threads on the CPUs of the node. The --preferred option has the same effect as NUMAPolicy=preferred. Add the other tsmb-server options as described in Starting.
The interrupt affinity of the network interface is a separate setting. Set the interrupts of the interface to CPUs on the same node, for example with the IRQ affinity script of the NIC vendor. The irqbalance service can change the affinity again, so exclude the interface from irqbalance or stop the service.