How to configure SMB compression on Windows Server 2022 and clients


Storage performance is often hampered by slow connectivity between clients and file servers. Clients can communicate with network servers over a Wi-Fi link, for example. However, even if high-speed connectivity is available, the network link can become congested if too many clients are using it simultaneously. One way to relieve some of the congestion is to turn on SMB compression. SMB compression is new in Windows Server 2022 and compresses network traffic flowing to and from SMB file shares.

Before we show you how to configure SMB compression, there are two things you should know. First, SMB compression only works with Windows Server 2022 and requires clients to be running Windows 11. (A Windows Server 2022 machine can also act as a client.) Second, SMB compression creates CPU overhead when data are compressed and uncompressed. As such, SMB compression is a poor choice for use on already CPU limited systems.

File server configuration

To enable SMB compression, open Windows Admin Center and connect to your Windows Server 2022 file server. Then click on Files and File Sharing tab, as shown in Figure 1.

Figure 1

Click the Files and File Sharing tab.

In the figure above, you will notice that the screen is divided into three vertical sections, with the middle section showing the file system tree. Just above the word Files, there is a tab titled File Shares. Click the File Shares tab. As you can see in Figure 2, this tab lists the file shares that exist on the server (and gives you the option to create new shares).

SMB compression 2.jpg

Figure 2

The File Shares tab lists the file shares that exist on the server.

Now click on the file share for which you want to compress SMB traffic. This will cause a Sharing Permissions pop-up to appear on the right side of the screen. Scroll to the bottom of this pop-up and then check the Compress data box, as shown in Figure 3. Make sure to click on the Edit button when you are done, otherwise your changes will not be saved.

SMB compression 3.jpg

figure 3

Check the Compress data box.

Client configuration

Enabling SMB compression on the server alone does not compress SMB traffic. You will also need to tell the client computer that you want to compress SMB traffic.

There are different methods to enable client side compression. You can, for example, configure Robocopy or Xcopy to use compression.

Another option is to map a network drive so that all traffic is forced to compress. To do this, open a PowerShell window and enter the following command:

New-SMBMapping -LocalPath  -RemotePath  -Compress Network Traffic $True

If I wanted to map drive F: to the data share on a server named Server22 then the command would be:

New-SMBMapping -LocalPath “F:” -RemotePath “Server22Data” -CompressNetworkTraffic $True

You can see this command in action in Figure 4 (although I used an IP address instead of a computer name in the remote path).

SMB compression 4.jpg

Figure 4

Here’s how you use the New-SBMMapping cmdlet to create a mapped network drive with compression enabled.

While this technique works well, it’s probably impractical to use PowerShell to map each required network drive, especially if the customer already has all of the mappings in place. As an alternative, you can create a registry value that will force the client to use SMB compression whenever possible.

As always, it is important to use caution when editing the registry, as an incorrect registry setting can severely damage Windows and / or your applications. It is always a good idea to create a backup before modifying the registry.

That said, you can create the necessary registry key by opening Regedit and then navigating the registry tree all the way here:

HKEY_LOCAL_MACHINESystemCurrentControlSetServicesLanmanWorkstationParameters

Next, you will need to create a new 32-bit REG_DWORD value named EnableCompressedTraffic and give it a value of 1. You can see what it looks like in Figure 5.

SMB compression 5.jpg

Figure 5

You can use the client registry to enable SMB compression.

As stated earlier, there are also tool specific options to enable SMB compression. You can find the full documentation from Microsoft, which includes instructions for these tools, here.


Comments are closed.