SMB compression behavior and settings changes in Windows 11


  • Staff
Heya folks, Ned here again. As you know from a previous post, we released an end-to-end SMB compression capability with Windows 11 and Windows Server 2022. You can learn all about it at SMB Compression | Microsoft Docs.

There was an idiosyncrasy in the initial design that we changed with the release of Windows Server 2022 update KB5016693 (OS Build 20348.946) and Windows 11 update KB5016691. From now on, if you request compression over SMB, we will attempt to compress the file regardless of its size or seeming suitability for compression. It doesn't matter how you request compression - robocopy, share setting, registry values - we will try to compress the file.

For those playing SMB Trivial Pursuit edition: previously, SMB compression used a default algorithm where it attempted to compress the first 524,288,000 bytes (500 MiB) of a file during transfer and track that at least 104,857,600 bytes (100 MiB) compressed within that 500-MiB range. If fewer than 100 MiB was compressible, SMB compression stopped trying to compress the rest of the file. If at least 100 MiB compressed, SMB compression attempted to compress the rest of the file. This means that very large files with compressible data - for instance, a multi-gigabyte virtual machine disk - are likely to compress but a relatively small file - even a very compressible one - would not compress. It meant you had to set registry overrides if you wanted files under 100MiB to compress, which of course didn't happen, that's way too esoteric for folks to know. Now we just assume if you try to compress, you want to compress.

This does mean that transferring some smaller, less-compressible files will now get some useless CPU time spent trying to compress them, but the solution is to just know your files. JPG, ZIP, DOCX, etc. formats that are already compressed see no advantage from SMB compression no matter their size. VHDX, ISO, DMP, and other large files with lots of whitespace will compress quite well.

This demo shows the ways you can use compression as an IT pro or have your users get compression without having to train them. It's only about 4 minutes and worth a watch.


Furthermore, we now have a set of Group Policy, PowerShell and registry options to control the legacy behaviors and to let you avoid editing the registry by hand for configuring client compression.

Group policy​


\Computer Configuration\Administrative Templates\Network\Lanman Workstation
Disable SMB Compression
Use SMB Compression by Default

\Computer Configuration\Administrative Templates\Network\Lanman Server
Disable SMB Compression
Request traffic compression for all shares

These all write to the following location and will override the 'native' registry settings as usual with group policy:

HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows\LanmanWorkstation\parameters

PowerShell for SMB client​


Set-SMBClientConfiguration [-EnableCompressibilitySampling <bool>] [-CompressibilitySamplingSize <uint64>] [-CompressibleThreshold <uint64>] [-DisableCompression <bool>] [-RequestCompression <bool>]

-DisableCompression $true or $False - never compress even if server or application requested
-RequestCompression $true or $false - always request compression even if server or application didn't specify it
-EnableCompressibilitySampling $true or $false - control legacy sampling behavior
-CompressibilitySamplingSize 1- 9,007,199,254,740,992 - size in bytes of range to sample in a file looking for compressibility
-CompressibleThreshold - 1- 9,007,199,254,740,992 - size in bytes of compressible data that must be found within that range

You shouldn't need to touch the sampling settings without a good reason. Maybe hit me up in the comments first if you're feeling the urge to touch those. :) A keen-eyed reader might notice that a range of 9,007,199,254,740,992 is not the Uint64 in the PowerShell. That's because the real limit in the code is 9PiB, not the 184,467,440,737,095,551,615 bytes of a UInt64 value we had to set in the Posh. If you've got individual files bigger than 9 petabytes, I would love to hear your story, regardless!

These values are stored in the registry under:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\LanmanWorkstation\parameters

NameTypeDefaultBoundsPS interface (Set-SmbClientConfiguration)
EnableCompressedTrafficREG_DWORD00 or 1RequestCompression
DisableCompressionREG_DWORD00 or 1DisableCompression
EnableCompressibilitySamplingREG_DWORD00 or 1EnableCompressibilitySampling
CompressibilitySamplingSizeREG_QWORD00 to 8 PiBCompressibilitySamplingSize
CompressibleThresholdREG_QWORD00 to 8 PiBCompressibleThreshold

PowerShell for SMB Server​


Set-SmbServerConfiguration [-DisableCompression <bool>] [-RequestCompression <bool>]

-DisableCompression $true or $False - never compress even if client requested
-RequestCompression $true or $false - always request compression even if client didn't specify it

These values are stored in the registry under:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\LanmanServer\parameters

NameTypeDefaultBoundsPS interface (Set-SmbServerConfiguration)
EnableCompressedTrafficREG_DWORD00 or 1RequestCompression
DisableCompressionREG_DWORD00 or 1DisableCompression

I'm updating SMB Compression | Microsoft Docs & PowerShell Help to cover all this too, don't worry.

You should get huge benefits from SMB Compression in many day-to-day operations, it's a time saving, bandwidth saving, and - now- very easy to use feature. More improvements are coming, this isn't the end.

Until next time,
- Ned "Squishing" Pyle

Source:

See also:
 

Attachments

  • Windows_11.png
    Windows_11.png
    152 bytes · Views: 0

hsehestedt

Well-known member
Power User
VIP
Local time
9:59 AM
Posts
1,209
Location
Texas, USA
OS
Windows 11 Pro 22H2
Wow, this is pretty great. I knew that Windows Server had this capability, no clue that Windows 11 had this. All by itself, this is a compelling enough reason for me to use Win 11 over Win 10 :-)
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 22H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Home Built
    CPU
    Intel i7-11700K
    Motherboard
    ASUS Prime Z590-A
    Memory
    128GB Crucial Ballistix 3200MHz DRAM
    Graphics Card(s)
    No GPU - CPU graphics only (for now)
    Sound Card
    Realtek (on motherboard)
    Monitor(s) Displays
    HP Envy 32
    Screen Resolution
    2560 x 1440
    Hard Drives
    1 x 1TB NVMe Gen 4 x 4 SSD
    1 x 2TB NVMe Gen 3 x 4 SSD
    2 x 512GB 2.5" SSDs
    2 x 8TB HD
    PSU
    Corsair HX850i
    Case
    Corsair iCue 5000X RGB
    Cooling
    Noctua NH-D15 chromax.black cooler + 10 case fans
    Keyboard
    CODE backlit mechanical keyboard
    Mouse
    Logitech MX Master 3
    Internet Speed
    1Gb Up / 1 Gb Down
    Browser
    Chromium Edge
    Antivirus
    Windows Defender
    Other Info
    Additional options installed:
    WiFi 6E PCIe adapter
    ASUS ThunderboltEX 4 PCIe adapter
  • Operating System
    Dual Boot Windows 11 Pro 22H2 and Windows 10 Pro 22H2
    Computer type
    Laptop
    Manufacturer/Model
    HP Spectre x360 15-BL012DX
    CPU
    Intel i7-7500U
    Memory
    32GB
    Graphics card(s)
    Dual Intel HD 620 and Nvidia GeForce 940MX
    Sound Card
    Built-in Realtek HD Audio
    Monitor(s) Displays
    4k 15-inch
    Screen Resolution
    4k (3840 x 2160)
    Hard Drives
    1TB Seagate FireCuda 510 NVMe SSD
    Internet Speed
    1Gb Up / 1Gb Down
    Browser
    Chromium Edge
    Antivirus
    Windows Defender
    Other Info
    RAM Upgraded from 16GB to 32GB WiFi Upgraded from WiFi 5 to WiFi 6 SSD upgraded from 512GB NVMe SSD to 1TB Seagate FireCuda 510 NVMe SSD

Latest Support Threads

Top Bottom