SMB compression is a new feature in Windows that allows you to enable inline compression when copying or moving files over the 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 in general it is built into the SMB 3 specification and can also be used on client devices.
SMB compression reduces bandwidth and decreases uptime when copying large files such as virtual machine disks, uncompressed graphics and videos, scientific data, and other types of large files that cause data failure. congestion when copying over a network. By using inline space compression to transfer files, SMB Compression improves performance with highly compressible file types. The only caveat is that SMB compression does not work on RDMA network adapters in SMB Direct mode. But Microsoft says it is looking to support this scenario in the future.
Compression is designed to support Hyper-V Live Migration with SMB and the Robocopy and Xcopy command line tools. SMB compression is already available with Robocopy and Xcopy in Windows Server vNext and Windows 10 20H2 preview. If the destination device supports SMB compression, file transfers should see significant performance improvements.
SMB compression performance measurement
Copying an uncompressed 10 GB file over a 1G Ethernet network using Robocopy takes approximately 2 minutes without compression. If you add the /compress switch, you can expect the same operation to take about 20 seconds with a similar load on the processor. Operations that copy already compressed files, such as JPEG images, will not be affected if you use the /compress switch.
Windows sees that the file is already compressed and ignores the switch to ensure that the file is copied without any unnecessary processing which might even increase the copy time. This is good in cases where you might not be sure how a file will work if SMB compression is enabled. Windows measures the effectiveness of compression and automatically turns it off if there is no benefit to using it.
Supported SMB compression algorithms
SMB Compression can negotiate the algorithm used, so more than one can be used and vendors can add their own as well. At the time of writing this article, XPRESS (LZ77), XPRESS Huffman (LZ77 + Huffman), and LZNT1 are supported. Microsoft claims that these algorithms provide the best compression and processor performance. Compression works with the existing SMB 3 specification. And while SMB compression is designed for IT professionals, Microsoft could consider scenarios where compression would benefit end users, such as enabling it on a mapped drive basis.
SMB compression is already available in Windows, assuming you are working with up-to-date feature versions. It was recently backported to Windows 10 version 2004, 1903, and 1909. At this time, Microsoft does not say when SMB Compression will arrive in Azure Files.