Table of Contents
- What is Memory compression
- Infrastructure and configuration
- Expectations and results
- Conclusion
Performance is a very important factor of the success of a virtual desktop environment. Since the release of Windows 10 and Windows Server 2016, Microsoft implemented memory compression, which is by default disabled on the server operating systems, but enabled on Windows 10. But is there any performance value when enabling memory compression, or does it come with a performance penalty? This research will take a closer look and will show the real value of memory compression in a Citrix Virtual Apps scenario.
What is Memory compression
It is important to start with a correct understanding of memory compression. Woshub.com shared an excellent description of memory compression.
The compressed memory feature is designed to improve the performance (responsiveness) of the system due to storing part of the memory pages in RAM in a compressed form. It helps to reduce the number of read / write requests to the memory pages in the slow (compared to RAM) paging file on a hard drive. The required data are extracted from the RAM faster even though additional CPU resources are spent to compress/decompress them.
To get all the details it is really recommend reading the full article, which can be found here.
Memory compression was introduced in Windows 10 1507 and Windows Server 2016. Since the introduction memory compression was running on the background but became a separate process since Windows 1607. The memory compression process is hidden from the task manager but visible for both PowerShell and Process Explorer.
Memory compression is disabled by default on the Server operating system and can be enabled by running the following PowerShell command “Enable-MMagent -MemoryCompression”. The command “Get-MMagent” will retrieve the current configuration, which can be used to validate if memory compression is running.
An important note, as shown in the screenshot, when enabling memory compression, page combining is also automatically enabled.
Page combining may help reduce memory usage on servers which have a lot of private, pageable pages with identical contents (which is likely to occur on multisession hosts). Page combining causes the memory manager to periodically combine pages in physical memory that have identical content. The tradeoff for page combining comes in the form of increased CPU usage and this may have a negative effect on the scalability and or performance.
Please note that page combining can be disabled independently from memory compression. For this research the default behavior of enabling memory compression is tested, so both settings were enabled.
Although the dedicated process is not visible in the task manager, it is possible to see the portion of memory that has been compressed. This can be done in the memory section on the performance tab.
This example is captured on a Windows 10 machine and shows it compressed 373MB on memory. In a shared user environment, it is expected a decent amount of memory can be compressed and/or to see many pages being combined, especially when user share the same type of workload.
Infrastructure and configuration
The research has taken place in the GO-EUC lab environment which is described here. The desktops are delivered using Citrix Virtual Apps and Desktops using MCS running with the Citrix VDA version 1912 and Microsoft Server 2016. The VM is configured with 8vCPU, 20GB memory, and a 64GB disk.
The page file settings on the VDAs were left as per default. This means that the page file is system-managed and can increase of decrease in size automatically by Windows. The maximum page file size is 3 x RAM or 4GB, whichever is the largest amount. More information on the page file can be found here.
In order to test the benefit of memory compression, the following scenarios are executed:
- Memory compression disabled, as the baseline.
-
Memory compression enabled*
- *For this scenario page combining was also automatically enabled.
Each scenario is tested using the default testing methodology which is described in detail here. As it is a best practice, each deployment is fully updated and optimized using the Citrix Optimizer with the corresponding template.
Expectations and results
It is expected to see a benefit in memory usage when enabling memory compression, as the same workload is simulated on the Citrix environment. Based on the theory, this means memory can be shared and therefore compressed. But as the compression is done by a separate dedicated process, there can be a penalty on CPU utilization. The primary bottleneck of the GO-EUC environment is CPU instead of memory. The expectancy is that there will be a positive effect on the total memory usage.
Because the CPU is the primary bottleneck, the first results to have a look at will be the CPU utilization of the hypervisor.
Lower is better
Lower is better
At first glance there is not any noticeable difference on the CPU utilization. However, the line chart does show a bit more fluctuation once memory compression is enabled. This might be caused by the additional process for memory compression.
As there is no effect on the CPU utilization there might be a visible difference on memory. As multiple data sources are collected the memory usage from both hypervisor and VM will be shown.
Lower is better
Lower is better
Lower is better
Lower is better
Memory shows almost no difference in memory consumption although compression is enabled. A difference of 0.64%, which is rounded 1%, is neglectable. It was expected to see at least a difference on memory. However, it does show the minimal difference at the end of the workload around 38 minutes, which might be an indication paging is taking place when memory compression is disabled.
In order to validate if paging is taking place the hypervisor storage metrics is a perfect metric to start with.
Lower is better
Lower is better
Lower is better
When enabling memory compression there is a difference in both reads/sec and writes/sec. It is hard to pinpoint the exact cause of this behavior, but this might due to the page file on the disk. As memory is compressed in the enabled scenario, the page file probably is not used and therefore results in a lower storage load.
In order to prove this hypothesis, it is possible to leverage Performance Monitor to capture the page file usage. Page file usage is the amount of the “Page File instance in use in percent”.
Lower is better
Lower is better
The comparison shows huge difference in the page file usage. To provide context, the following table shows the absolute numbers of the comparison.
Metric | Disabled | Enabled |
---|---|---|
Page File Usage | 3.4774 | 0.0013 |
The difference starts at the end of the test, at 38 minutes into the workload. Although memory is not fully utilized, paging does occur when memory compression is disabled. With memory compression no paging is taking place as the compression frees up memory. Although this was not clearly visible in the memory usage metrics, this does proof the benefit of memory compressions from a memory perspective.
This does explain the difference on the storage results, as paging is causing the additional IOPs.
For this research the page file is system managed. The results seem not to give a clear image of the true impact of memory compression as even in the enabled scenario, the page file is used at maximum of 0.03%.
Conclusion
Since the introduction of memory compression in Windows 10 1507 and Windows Server 2016, the operating system is able to store parts of the memory pages in a compressed form. When enabling memory compression, page combining is enabled automatically. Because there are no dedicated metrics for both memory compression and page combining in Windows Performance Monitor, all results are based on the combination of both features.
An important conclusion of this research is, when the environment is properly sized, memory compression is taking place but does not show any performance benefit. It might be different when the environment is undersized on memory.
It is noticed memory compression results in less paging that reduced the impact on storage. Although, as the environment of this research is properly sized, no CPU penalty for the memory compression is measured. At this point, it is not clear what the effect will be once memory compression is highly used.
There is no clear performance counter available showing the compressed memory results. It is expected memory compression is taking place right from the start but based on the results the difference is noticed when paging is taking place. This is around 60 percent memory usage in this specific research.
This research is primary focused on the scalability benefit of memory compression and does not take any improvement of session responsiveness into account. Based on the captured dataset it is not possible to determine any benefit and will require additional research.
Take for example the fact that when enabling memory compression, page combining is enabled as well. Does this only measure the effect of memory compression? No, it is a combination of both.
In theory, the effect of memory compression should be noticeable when memory is undersized but in order to proof this, another research is required. If you find this interesting, please let us know in the comments below, as the researches are scheduled based on community demand.
Note: There has been some reports that the memory compression causes blue screens, so before implementing in your environment, test! During testing, there were no blue screens in our environment.
What is your experience with memory compression? Please let us know in the comments or at the World of EUC Slack channel.
Photo by Michael Dziedzic on Unsplash
If you look at the Windows 10 or Windows 11 TASK MANAGER you will notice something new on the PERFORMANCE > MEMORY tab. The memory IN USE (COMPRESSED) tells you how much of your RAM is being used by compressed bits:
Memory Compression is a simple way to stuff more things into your RAM instead of using (or using less of) a paging file on your hard drive.
What is Memory Compression?
Memory Compression is like a cache for memory. Confused? Don’t be, it isn’t that complex.
Memory compression technology takes a (dynamically changing) amount of your physical RAM and blocks it off for use by lesser used files that your computer previously loaded into RAM. The idea is that your RAM likely has been loaded with a pile of files that it really isn’t going to use right now, but might in the immediate future, so it doesn’t want to dump them out of RAM. However, before the those files are relegated, they are compressed so they take up less space.
Can I See What Is In Compressed Memory?
No, and neither can your computer. Well, to be clear, your computer knows what is in the compressed part of your RAM but cannot interact with it, other than to request it be decompressed and moved to the “usable” part of your RAM.
What Good Is Compressed Memory?
In a word, speed. If your computer does not have compressed memory, it will simply store excess “memory” as a physical file on your hard drive and as fast as Solid State Drives are today, they are no match for RAM that is closer to the CPU where it is needed.
Does Compressed Memory Replace a Page File?
Now you are getting it. Yes, decompressing memory already in memory is much faster than copying files from a page file (sometimes called a swap file) into memory. You will still likely have a page file but it will be smaller and much less used that it would be without compressed memory.
Is Compressed Memory Something New?
Compressed memory has been in use since 1990 and has fallen in and out of favor over the years as the price of RAM and fast drives (like SSD‘s) have changed.
Aren’t Compressed Memory Programs a Scam?
They have been, often providing little to no value. In fact, the worst was SoftRAM which was a program for Windows 95 which literally did nothing. It is infamous now and even Microsoft has a good write up from 2021 on it HERE. A 1996 program named Hurricane added only a modest 5% but according to an popular 1997 test from PC Magazine, that was pretty good because the other 5 so called “Performance Enhancers” they played with resulted in zero improvement.
Today however, Microsoft has integrated compression technology into the operating system so you are paying nothing extra for it… and it actually works.
Does Windows Server 2016 19 & 22 Use Memory Compression?
Not by default, but Memory Compression can easily be enabled on Windows Server.
Why is Memory Compression Disabled on Windows Server?
I don’t know for sure why memory compression is off on Windows Server by default, but I suspect it is because it takes a fair amount of CPU cycles to compress and decompress RAM and, unlike most home computers, servers really use their CPU’s.
How To Disable Memory Compression in Windows?
Disabling Memory Compression in Windows 10 and 11 is easy enough but very much NOT recommended. Microsoft’s memory compression works and saves wear on your disk because it is not “paging” as much, but if you want to:
- Right Click on the START button and select which ever command prompt you have (CMD Prompt will not work)
- POWER SHELL (Run as Administrator)
- WINDOWS TERMINAL (Run as Administrator)
- Type these commands as you wish:
Show the status:Get-MMAgent
Turn MM off:Disable-MMAgent -mc
Turn MM on:Enable-MMAgent -mc
-
Has anyone seen any real-world (not theoretical) gains by using memory compression in Server 2016?
Or does this only show gains with large amounts of users and apps running?
Stop hovering to collapse…
Click to collapse…
Hover to expand…
Click to expand…
-
Seriously?
Am I the only one that turned it on?
So I’m guessing no one else is trying/using PageCombining either?
Stop hovering to collapse…
Click to collapse…
Hover to expand…
Click to expand…
-
Possibly !
I know I didn’t and I haven’t a clue what you are talking about.Didn’t stuff like memory compression die out in the win3.11~win95 era ?
I’m working on moving a crashed win2012R2 raid over to a Server 2016 at the moment and I still got some experimentation time available with the server if you wish to elaborate. -
Its like new topic i guess it need more research
-
I’m definitely not much of an educator , but I (guess falsely) assumed people using Server 2016 were aware or looked into what were «relatively new» features first, when moving to it to see what the improvements were over prior versions and tune it for best performance for their usage.
But then again there is nothing «new» about either of these, I guess most users were just not aware they existed .
That must mean they have been working well.Memory Compression was originally called Ram Compression in early Windows 10 versions and earlier OSs. It has been in use as part of the OS since Win8 and Server 2012. It has always been turned «on» by default in Win10 and turned «off» by default in Server 2016.
Page Combining was originally known as Memory Combining and has also been around since Win8 and Server2012. Again it was turned «on» by default in the consumer OS and «off» by default in the server OS and still is as of Win10 and Server 2016.
As I understand it, the names were changed/fine tuned (Ram Compression->Memory Compression and Memory Combining->Page Combining) to reduce confusion of which did what.
All can be controlled/interfaced through PS and the Memory Management Agent Module.
When the «newer» memory management was introduced in Win8 and Server2008, these and other benefits have been steadily evolving and improving.As for what each exactly does and how, it’s probably best if you «search» each one @ technet.microsoft.com as there is much to read and understand.
Stop hovering to collapse…
Click to collapse…
Hover to expand…
Click to expand…
-
Thanks for pointing me in the right direction.
After reading up a bit it seems that where all those years back this type of solution didn’t really result in any real world benefits it is now suggested that by the sheer increase in processing power it can actually yield some performance gains. However I’m still not totally convinced when I see numbers like ’20Mb’ gains in free memory. Although I do believe that small bits help the amounts of memory that people have in their computers these days is a magnitude more than the gains some people are talking about on the web.
Probably I shall give it a try to get a feel for it myself.
I would assume that potential stability and reliability issues are keeping Microsoft from enabling this technology by default any time soon in the server (enterprise) environment. -
Stop hovering to collapse…
Click to collapse…
Hover to expand…
Click to expand…
-
Fair enough.
Wish me luck, I’ve just enabled PagCombining and MemoryCompression on my serverFor those who wish to follow. In Powershell (admin rights) use the commands :
Enable-MMAgent -PageCombining
Enable-MMAgent -MemoryCompressionYou can check the status using the command :
Get-MMAgentAnd you can see the memory compression at work via task manager>performance>memory by hovering over the memory composition graph.
-
I am going to enable and check, if there is any improvement. This server is 2016 running sql 2016 on cm 1702.
-
It is all related to Superfetch
Get-MMAgent with Superfetch service running on Windows 10
ApplicationLaunchPrefetching : True
ApplicationPreLaunch : True
MaxOperationAPIFiles : 256
MemoryCompression : True
OperationAPI : True
PageCombining : True
PSComputerName :Get-MMAgent with Superfetch service stopped on Windows 10
ApplicationLaunchPrefetching : False
ApplicationPreLaunch : False
MaxOperationAPIFiles : 256
MemoryCompression : False
OperationAPI : False
PageCombining : False
PSComputerName :It is all in real time, stopping/starting Superfetch shows the results above immediately.
-
Yes, I thought I made it clear that all those were turned on by default in Win 10 (as is SuperFetch), and since we are talking about Server 2016, I’m not sure of the point you are trying to make.
Server 2016 does not have any of those processes turned on by default, nor is SuperFetch, but activating any of those processes automatically activates SuperFetch also (as a delayed autostart service), as it is required for those processes.
But once any of those processes is activated, deactivating them does not change the activation status of SuperFetch in either Server 2016 or Win10, that must be done manually.
Superfetch shows up as the «Sysmain» service (sysmain.exe).You can change the «MaxOperationAPIFiles» by the following command from an Administrator level Powershell —
«reg add «HKEY_LOCAL_MACHINE\Software\Microsoft\Windows NT\CurrentVersion\Prefetcher» /v MaxPrefetchFiles /t REG_DWORD /d 8192 /f»
In the above example «8192» is the maximum number of files the prefetcher will open at any given time and as always, multiples of 8 work best.
Stop hovering to collapse…
Click to collapse…
Hover to expand…
Click to expand…
-
Stop hovering to collapse…
Click to collapse…
Hover to expand…
Click to expand…
-
May be so, can’t say I’ve seen any positive or negative effects. My server is still humming along.
-
Whether memory compression helps, hurts performance, or does nothing is going to depend on the kind of workload you’re running, how much RAM you have, how much processor power and storage i/o throughput.
- People seem to love IoT and all the pervasive monitoring it brings. Automated IoT devices monitoring your driving habits and tracking where you go all the time. What’s strange, people really love it. Why? Well, because they get large discount on car insurance. This development was pretty expected and will lead to total loss of privacy for most people in future. Yet as said. The mobile phone was first monitoring and tracking device which got widely accepted by population. They loved it, so it’s pretty obvious other monitoring & tracking will be also gladly accepted. Even funnier is that people are ready to pay large sums and often update their tracking devices to the latest version. — Same applies to the social networks, people are happy and eager to report everything they do directly to intelligence agencies. And they love it. — Great.
- Even more IPv6 fun. It seems that some routes between Finland and Central European data center we’re using are nicely looping via New York and Chicago. Honestly, this is daily WTF stuff. Instead of getting around 36 ms latency, we’re getting neat 152 ms. Oh joy!
- Be careful about what you dislike.- Great post! So true. As I’ve said, you’ve gotta be flexible. If you disliked or liked something in past, it might not mean you might dislike or like it in future. Especially when your personal views as well as other factors change. We’ve just talked today about adequate quality at work again. Doing things too well is expensive and wastes resources. Doing things badly, is even more expensive and leads to all kind of resource loss on multiple levels as well as internal conflict, loss of motivation and other nasty stuff. But it’s very hard to get the quality just right. Also same thing might be viewed completely differently depending on your own position on the argument. Even if I prefer ‘neutral’ and ‘generalized’ view, which acknowledges both parties and complete overview. Also your position and role might make having some opinions officially impossible. Because it isn’t just your task or job. But hey, we all know that. CEO of oil company just can’t say certain things about oil, energy or environment. That’s part of the job.
- I thought data is data, and instructions are instructions. Today I just first time saw new word with really made me laugh. NoSQL injection. — Ouch!
- More discussion about IPv6 issues, 6rd and 6to4. Yes, unfortunately not all provides provide native IPv6 or even bother to run 6rd.
Friend claimed that Windows 2016 Server doesn’t use Memory Compression. Well, it does support Memory Compression and it can be trivially enabled using PowerShell.
PS C:\Users\Administrator> Get-MMAgent
ApplicationLaunchPrefetching : False
ApplicationPreLaunch : False
MaxOperationAPIFiles : 256
MemoryCompression : False
OperationAPI : False
PageCombining : False
PSComputerName :
Let’s «fix» that, in case we conclude it’s better to use memory compression, than add more memory or to use swapping.
PS C:\Users\Administrator> Enable-MMAgent -mc
PS C:\Users\Administrator> Get-MMAgent
ApplicationLaunchPrefetching : False
ApplicationPreLaunch : False
MaxOperationAPIFiles : 256
MemoryCompression : True
OperationAPI : False
PageCombining : False
PSComputerName :
That’s it. Now memory compression is enabled, and this reduces amount of data being swapped to to disk.
kw: enable memory compression Windows Server 2016, swap compression, data compression.
For comparison same info with latest Windows 10 desktop.
PS C:\WINDOWS\system32> Get-MMAgent
ApplicationLaunchPrefetching : True
ApplicationPreLaunch : True
MaxOperationAPIFiles : 256
MemoryCompression : True
OperationAPI : True
PageCombining : True
PSComputerName :
Of course this comes once again to the balance of storage I/O, RAM, CPU etc. Compression can be amazing or disaster, depending on so many factors. There’s no magic way to tell if it’s good or bad. It depends on combination of so many different factors.
So it’s just like zram or zswap on Linux, it’s inherently there, but not enabled by default. Also see: compcache
You are here: Home/ Windows/ What Is Memory Compression On Windows 10/11? [Complete Guide]
Windows memory compression helps to improve the system’s performance and store more data in the memory of your system.
The memory manager compresses the infrequently accessed memory pages.
This lowers the read and write to the page file, and improves your system’s responsiveness.
In Windows 10 and 11, memory compression can be enabled and disabled. Here we will discuss how to do both and also explain memory compression in detail.
Also read: Fix: Desktop Window Manager (dwm.exe) High Memory Usage
Memory compression is a technique to manage the memory of your system.
It reduces the size of the inactive data in the RAM and frees up the unused space.
With memory compression, you can use the total available physical memory of your device and run more programs.
With memory compression, you can compress some pages in RAM and optimize RAM utilization.
This way you will be able to keep more processes in the physical memory without paging the data out to disk and reading them from the page file.
When Was Memory Compression Introduced On Windows 10/11?
Windows memory compression was introduced in Windows Server 2016 and Windows 10 1507.
It was first introduced to run as a background process, but with Windows 1607 it became a separate process.
Memory compression is only available for Windows 10, 11 and not for Windows 7, 8 or other prior Windows versions.
Can Memory Compression Lead To High Usage Of RAM?
Windows uses a page file to store data that RAM cannot hold when it is full.
Memory compression is better than paging out the data to the disk. It is a much faster way.
But one thing you must remember is that in both compressing and uncompressing memory, you need to use some of the CPU resources.
Windows automatically compresses data whenever it requires space.
Your PC may become a bit slower due to memory compression.
So, if you find that memory compression is affecting the performance, you may need to upgrade your RAM.
How To Check Windows 10 and 11 Memory Compression Details?
To see the compressed memory details on your device, follow the steps given below:
- Right-click on the Windows Start button and select Task Manager. You can also press Shift + Ctrl + Esc keys to open Task Manager.
- Click on More details to expand the Task Manager interface.
- Now go to the Performance tab and click on Memory from the left side.
- You will get the details of the compressed Windows memory under In-use (compressed) section.
- To get more details about your compressed memory, hover the mouse over the Memory Composition.
Like here in my device, the system uses 3.7 GB of physical memory.
It has 188 MB of compressed memory and this compressed memory stores about of 575 MB data. So, there are 387 MB of memory savings.
How To Enable Memory Compression On Windows 10/11?
To enable Windows 10 and 11 memory compression, run the Enable-MMAgent –mc command in PowerShell. Here is how you can do it:
- Enter Windows PowerShell in the search bar. Right-click on Windows PowerShell and choose to run it as administrator.
- Type the following command in the command box and press Enter.
Enable-MMAgent –mc
Wait till the process gets completed. Restart your PC to apply the changes.
How To Disable Memory Compression On Windows 10/11?
Sometimes you may need to disable memory compression as it can slow down the performance of your PVC.
To disable Memory Compression on Windows 10 and 11, you have to run the Disable-MMAgent –mc command on Windows PowerShell.
Though I will recommend you to keep the feature on, if you want to disable memory compression then follow the steps given below:
- Run PowerShell as an administrator.
- Type the following command in the command box and press Enter.
Disable-MMAgent –mc
- Wait till the process gets completed. After that restart your computer to apply the changes.
Frequently Asked Questions [FAQs]
Here are answers to some common questions regarding memory compression on Windows 10 and 11.
- Does Windows 10 and 11 Need Memory Compression?
Yes, memory compression is needed on Windows 10 and 11 as it optimizes RAM utilization, speeding up your PC.
- Is Memory Compression Good For Memory?
Yes, as it compresses the data before storing it, saving space for more files and eventually leading to a faster PC.
- Can I Turn Off Memory Compression On Windows 10 and 11?
Yes, you can turn off memory compression on Windows 10 and 11 by running the ‘Disable-MMAgent –mc’ command in Windows PowerShell.
Closing Up
So, Windows 10 and 11 memory compression optimizes RAM by compressing pages.
For further queries, reach us by commenting in the section given below.