Performance FAQ

Updated at:

This topic describes the FAQs and solutions related to the performance of NAS SMB/NFS file systems.

What is the relationship between NAS performance and storage capacity?

  • General-purpose NAS

    The upper limit (peak value) of read and write performance of a file system is linearly and positively correlated with the current used capacity of the file system. That is, the larger the used capacity, the higher the upper limit (peak value) of throughput performance. For more information, see General-purpose NAS.

  • Extreme NAS

    The read and write performance of a file system increases in a stepwise manner as the provisioned capacity grows. For more information, see Extreme NAS file systems.

What is the relationship between NAS performance and directory size?

The following conditions may slow down responses during directory traversal:

  • The directory is being modified: for example, when files are created, deleted, or renamed, the cache may be invalidated frequently.

  • The directory is too large: when you traverse a large directory, responses become very slow due to cache eviction.

Solution:

  • Avoid excessively large directories. Keep the number of files in a single directory below 10,000.

  • Do not modify directories frequently during directory traversal.

  • For traversal of a large directory that does not need to be modified frequently, consider mounting the file system over the NFS v3 protocol and adding the nordirplus parameter to improve efficiency. Verify this approach before using it.

How do mount parameters affect NAS performance?

Mount parameters have a significant impact on NAS performance. The following describes the specific effects of mount parameters on performance:

  • rsize and wsize:

    • Impact: These parameters define the block size for data exchange between the client and the server. A larger block size reduces the number of network requests and improves throughput, especially when large files are processed.

    • Recommended value: 1048576 (1 MB). We recommend that you use the maximum value. A small block size may cause more network overhead and degrade performance.

  • hard:

    • Impact: After this option is enabled, if File Storage NAS is unavailable, the client keeps retrying requests until the file system recovers. This ensures data integrity and consistency.

    • Recommendation: Enable this option. It helps prevent data loss but may cause applications to suspend temporarily. Therefore, it is suitable for scenarios that require high availability.

  • timeo:

    • Impact: This parameter defines how long the client waits for a response before it retries. A timeout that is too short may cause frequent request retries and degrade performance, especially on unstable networks.

    • Recommended value: 600 (60 seconds). This ensures that the network has enough time to recover and reduces the number of retries.

  • retrans:

    • Impact: This parameter defines the number of times that the NFS client retries a failed request. A higher retry count increases the probability of success but may add latency.

    • Recommended value: 2. This value balances performance and data reliability.

  • noresvport:

    • Impact: After this option is enabled, a new TCP port is used when the network reconnects. This prevents connection interruptions during network failure recovery and improves network reliability.

    • Recommendation: Enable this option. It ensures the stability of network connections.

Important
  • We do not recommend the soft option because it poses data consistency risks. If you use the soft option, you assume the associated risks.

  • Avoid setting mount options other than the defaults. Changing the read or write buffer size or disabling attribute caching may degrade performance.

How does the bandwidth of an ECS instance limit NAS performance?

Throughput cannot exceed the internal network bandwidth of the ECS instance. If the internal network bandwidth is too low, throughput is subject to traffic throttling.

What happens when read or write throughput exceeds the threshold?

If the throughput of requests that you or your applications send exceeds the threshold, NAS automatically throttles the requests, which increases latency.

For General-purpose NAS, you can increase the throughput threshold by using the Truncate command. For more information, see How do I increase the read and write throughput threshold of a General-purpose NAS file system?.

For Extreme NAS, you can increase the throughput threshold by scaling out the file system. For more information, see Scale up an Extreme NAS file system.

For information about the throughput thresholds of General-purpose NAS and Extreme NAS file systems, see General-purpose NAS performance metrics and Extreme NAS performance metrics.

How do I increase the read and write throughput threshold of a General-purpose NAS file system?

The read and write throughput of a General-purpose NAS file system grows linearly with the used capacity of the file system. For the relationship between the read and write throughput of a file system and its used capacity, see General-purpose NAS product specifications.

You can increase the used capacity of a file system by writing a sparse file to the file system or by generating a file with the Truncate command, thereby improving the read and write throughput of the file system. Sparse files and files generated by the Truncate command occupy actual capacity on Alibaba Cloud NAS and are billed based on the actual size. For more information, see Billing for General-purpose NAS.

For example, writing a 1 TiB file to a Capacity NAS file system can increase its read and write throughput by 150 MB/s. Writing a 1 TiB file to a Performance NAS file system can increase its read and write throughput by 600 MB/s.

  • Linux

    You can use the Truncate command to generate a file and increase read and write throughput.

    sudo truncate --size=1TB /mnt/sparse_file.txt

    In this command, /mnt is the mount path of the file system on the compute node.

  • Windows

    You can write a sparse file to the file system to increase read and write throughput.

    fsutil file createnew Z:\sparse_file.txt 1099511627776

    In this command, Z:\ is the mount path of the file system on the compute node.

How do I resolve poor NAS access performance on Linux?

  • Solution 1: Use the nconnect parameter to improve the throughput of a single ECS instance that accesses NAS

    The nconnect parameter is a Linux mount option for the NFS client. It improves throughput performance by establishing more TCP transmission connections between the client and the server. Tests show that the nconnect parameter can increase the throughput of a single ECS instance that accesses NAS by 3 to 6 times, reaching 3 GB/s.

    Applicable scenarios

    Multiple concurrent I/O operations on a single ECS instance (concurrency greater than 16).

    Prerequisites

    The Linux kernel version must be 5.3 or later.

    Procedure

    Add the nconnect parameter to the mount command. We recommend that you set nconnect=4. Example command:

    sudo mount -t nfs -o vers=3,nolock,proto=tcp,rsize=1048576,wsize=1048576,hard,timeo=600,retrans=2,noresvport,nconnect=4 
    Important

    nconnect improves the throughput capability of a single ECS instance that accesses NAS but does not increase the throughput threshold of the NAS file system itself. For single-concurrency, small-data-block, or latency-sensitive workloads, enabling nconnect increases latency, and we do not recommend that you enable it.

    Note

    The nconnect parameter is designed for the Multi-Channel session mechanism of NFSv4.1 and later. When you use nconnect with the NFSv3 protocol, the Linux kernel still establishes the specified number of TCP connections to improve throughput. However, because NFSv3 does not support session binding, the server treats these connections as independent clients, and they do not have the ordered scheduling or transparent failover capabilities of NFSv4.1 Multi-Channel. In Alibaba Cloud NAS scenarios, the combination of vers=3,nconnect=4 in the preceding example can still effectively improve the access throughput of a NAS file system and is suitable for NAS performance optimization.

  • Solution 2: Modify sunrpc.tcp_slot_table_entries to improve the throughput of a single ECS instance that accesses NAS

    In the Linux kernel, sunrpc determines the number of communication slots in a single NFS connection. Different Linux versions use different configurations. A slot count that is too high may increase latency, and a slot count that is too low may cause insufficient throughput. When you require high throughput, we recommend that you set the slot count to 128. When you require low latency, set the slot count to 16 or less.

    Note

    Tuning sunrpc.tcp_slot_table_entries is far less effective than nconnect. We recommend that you use the nconnect parameter on operating systems with kernel 5.3 or later.

    Applicable scenarios

    Multiple concurrent I/O operations on a single ECS instance, and the kernel version is earlier than 3.10.

    Procedure

    For more information, see Modify concurrent NFS requests.

Why does it take a long time for NGINX to write logs to a file system?

  • Background information:

    Two directives are related to NGINX logs. log_format is used to set the log format, and access_log is used to specify the storage path, format name, and cache size of log files.

  • Problem description:

    It takes a long time for NGINX to write logs to the file system, and the write performance is poor.

  • Cause:

    The log file path in the access_log directive contains variables. Each time a log is written, the file is reopened, the log is written, and then the file is closed. To ensure data visibility, NAS writes the data back to the server when the file is closed, which consumes considerable performance.

  • Solution:

    • Solution 1: Remove the variables from the access_log directive and use a fixed path to store the log file.

    • Solution 2: Use the open_log_file_cache directive to set the cache of file descriptors for frequently used log files and improve the performance of log file storage paths that contain variables. For more information about the configuration, see open_log_file_cache.

      Recommended configuration:

      open_log_file_cache max=1000 inactive=1m valid=3m min_uses=2;

Why are I/O operations delayed on an SMB file system?

  • Problem description:

    When you directly access an SMB file system through a mount target, I/O operations may take several minutes to complete.

  • Causes:

    • An NFS client is installed but not used by actual workloads, which causes wait time.

    • The WebClient service is enabled, which causes Internet file servers to fail to log on to the SMB file system.

    • The registry configuration contains the NFS provider Nfsnp, which causes files to fail to open.

  • Solution:

    1. When you access the SMB file system for the first time, ping the mount target to check the connectivity between the compute node and the file system and whether the latency is within the normal range.

      • If the ping command fails, check your network settings and make sure that the network connection is normal.

      • If the latency is high, ping the mount target IP address. If the latency of ping on the IP address is much lower than that of ping on the DNS name, the issue may be a DNS problem. Check your DNS server configuration.

    2. If an NFS client is installed but the NFS service is not needed, uninstall the NFS client.

    3. Disable the WebClient service.

    4. Check the registry value HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\NetworkProvider\Order\ProviderOrder. If the value contains Nfsnp, remove Nfsnp and restart the instance.

Note
  • You can use the Fio tool to check whether the performance metrics are abnormal.

    fio.exe --name=./iotest1 --direct=1 --rwmixread=0 --rw=write --bs=4K --numjobs=1 --thread --iodepth=128 --runtime=300 --group_reporting --size=5G --verify=md5 --randrepeat=0 --norandommap --refill_buffers --filename=\\<mount point dns>\myshare\testfio1
  • We recommend that you use large data blocks for I/O read and write operations. Small data blocks consume more network resources. If you cannot change the data block size, you can construct a BufferedOutputStream to write data with a specified buffer size.

Why are SMB I/O operations delayed on Windows Server?

  • Cause:

    Windows SMB clients do not enable the large mtu option by default, which affects the improvement of I/O performance.

  • Solution:

    You can enable the large mtu option by modifying the registry. Registry path: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\LanmanWorkstation\Parameters

    Under this path, add a key of the DWORD type named DisableLargeMtu, set its value to 0, and restart the instance for the change to take effect.

How do I improve IIS access performance to NAS?

  • Cause:

    IIS accesses NAS in the NAS Share manner. When IIS accesses a file, IIS makes multiple backend requests to NAS. Unlike access to a local file system, each access to NAS requires at least one network interaction. Although each access takes a short time, the accumulated time of multiple accesses may cause a long total client response time.

  • Solution:

    1. We recommend that you use the SMB redirector component for optimization. For more information, see SMB2 Client Redirector Caches Explained.

      The registry path is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\services\LanmanWorkstation\Parameters. Set the following three configuration items to 600 or higher.

      • FileInfoCacheLifetime

      • FileNotFoundCacheLifetime

      • DirectoryCacheLifetime

      Note

      If none of the three registry configuration items exist:

      1. Confirm that you are using an SMB file system.

      2. Check whether your Windows version supports these three registry configuration items. If the Windows version supports them but the items do not exist, create them manually. For more information, see Performance tuning for file servers.

    2. We recommend that you store frequently accessed web content such as JS and CSS files locally.

If the current IIS read and write performance cannot meet your business requirements, submit a ticket.

Why does the ls command hang or become unresponsive?

  • Symptom

    The system hangs or becomes unresponsive during directory traversal. For example, this can occur when you run the ls command, perform operations that contain the wildcards *?, run the rm -rf command, or make the getdents system call.

  • Cause analysis

    • If the directory is being modified at the same time during directory traversal (for example, files are created, deleted, or renamed), the traversal responds very slowly because the cache is frequently invalidated.

    • When you traverse a large directory, the traversal responds very slowly due to cache eviction.

  • Solution

    • Avoid excessively large directories. Keep the number of files in a single directory below 10,000.

    • Do not modify directories frequently during directory traversal.

    • If the target directory is large (contains more than 10,000 files) and does not need to be modified frequently during directory traversal, you can mount the file system over NFSv3 and add the nordirplus parameter. This measure can improve performance to a certain extent. Verify this approach before using it. For more information, see Mount parameters.

How do I improve NFS sequential read performance on Linux kernel 5.4 or later?

The NFS read_ahead_kb parameter defines the amount of data (in KB) that the Linux kernel reads ahead or prefetches during sequential read operations.

For Linux kernel versions earlier than 5.4.* , the value of the read_ahead_kb parameter is set to NFS_MAX_READAHEAD multiplied by rsize (the size of the data that the client reads, as set in the mount options). Starting from Linux kernel version 5.4.*, the NFS client uses a default read_ahead_kb value of 128 KB. Therefore, when you use the recommended mount options, we recommend that you increase the value of the read_ahead_kb parameter to 15 MB.

After you mount the file system, you can run the following commands to reset the value of the read_ahead_kb parameter. Replace nas-mount-point with the local path where the file system is mounted, and replace read-ahead-kb with the required data read or prefetch size in KB.

device_number=$(stat -c '%d' nas-mount-point)
((major = ($device_number & 0xFFF00) >> 8))
((minor = ($device_number & 0xFF) | (($device_number >> 12) & 0xFFF00)))
sudo bash -c "echo read-ahead-kb > /sys/class/bdi/$major:$minor/read_ahead_kb"

The following commands use the local mount path /mnt as an example and set the read or prefetch size of read_ahead_kb to 15 MB.

device_number=$(stat -c '%d' /mnt)
((major = ($device_number & 0xFFF00) >> 8))
((minor = ($device_number & 0xFF) | (($device_number >> 12) & 0xFFF00)))
sudo bash -c "echo 15000 > /sys/class/bdi/$major:$minor/read_ahead_kb"

Why is the first connection to SMB slow?

  • Cause:

    The first connection to an SMB share is slow. This is usually because the Windows client tries multiple invalid network providers when it connects or because DNS resolution is delayed.

  • Solution:

    Warning

    Modifying the registry is risky. Before you proceed, create a system snapshot or back up the registry.

    Step 1: Optimize the network provider order

    1. Press Win+R, enter regedit, and open Registry Editor.

    2. Navigate to the following path: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\NetworkProvider\Order

    3. In the right pane, find the value named ProviderOrder and double-click it.

    4. In the Value data text box, find and delete the Nfsnp and WebClient entries. Make sure that the commas between other providers are retained.

    5. Click OK to save.

    6. Restart the client ECS instance for the change to take effect.

    Step 2: Troubleshoot DNS resolution latency

    If the issue persists after Step 1, further check whether DNS resolution is slow.

    1. Open Command Prompt (CMD).

    2. Run ping <mount target address> and record the latency.

    3. Run ping <IP address of the mount target> and record the latency.

    4. Compare the results: If the latency of ping on the IP address is much lower than that of ping on the mount target address, DNS resolution is slow. Check the DNS configuration of your ECS instance.