SMB Compression Lowers Bandwidth and Improves Copy Times in Windows Server and Azure
SMB compression is a new feature in Windows that lets you turn on inline compression when copying or moving files across a network. SMB, or Server Message Block, is a protocol used to transfer files over a network. SMB compression is primarily intended for use with Windows Server and Azure Files, but it is built-in to the SMB 3 specification and it can be used on client devices as well.
SMB Compression lowers bandwidth and decreases operation times when copying large files like virtual machine disks, uncompressed graphics and video, scientific data, and other large file types that cause network congestion. Using inline whitespace compression to transfer files, SMB Compression benefits performance with very compressible file types. The only caveat is that SMB Compression doesn’t work on RDMA network cards in SMB Direct mode. But Microsoft says it’s looking to support this scenario in the future.
Compression supports Hyper-V Live Migration with SMB, and the Robocopy and Xcopy command-line tools. It is already available with Robocopy and Xcopy in Windows Server vNext preview and Windows 10 20H2. If the destination device supports SMB Compression, file transfers should see significant performance improvements.
Measuring SMB Compression performance
Copying an uncompressed 10GB file across a 1G Ethernet network using Robocopy takes about 2 minutes without compression. If you add the /compress switch, you can expect the same operation to take roughly 20 seconds with a similar load on the CPU. Operations that copy already compressed files, like JPEG images, will not be affected if you use the /compress switch.
Windows sees the file is already compressed and ignores the switch to make sure the file is copied without any unnecessary processing that might even increase copy time. That’s good in cases where you might not know how a file will perform if SMB Compression is enabled. Windows measures compression efficiency and turns off compression automatically if there are no benefits to its use.
SMB Compression algorithms
SMB Compression can negotiate the algorithm used, so it’s possible to use more than one and vendors can also add their own. At the time of writing, XPRESS (LZ77), XPRESS Huffman (LZ77+Huffman) and LZNT1 are supported. Microsoft says that these algorithms provide the best compression and CPU performance. Compression works with the existing SMB 3 specification. And although SMB Compression is designed for IT professionals, Microsoft might consider scenarios where compression would benefit end users, like enabling it on a per-mapped drive basis.
SMB Compression is already available in Windows, assuming you are working with up-to-date feature releases. It has recently been backported to Windows 10 version 2004, 1903, and 1909. At the moment, Microsoft isn’t saying when SMB Compression will come to Azure Files.