Windows Server Core Container Images Now 40 Percent Smaller
At the beginning of December, Microsoft announced upcoming changes to Windows Server Core container images that would make them 40% smaller. In a post on the .NET Blog, .NET Team Program Manager Richard Lander says that Insider images are 40% smaller than the latest (patched) 1903 images, based on the images in the Windows Server Core insiders Docker repo. Additionally, startup times to Windows PowerShell are 30-45% faster. Lander says that the improvements should apply in any scenario where Windows Server Core container images are used and will be most beneficial for scaling apps, continuous integration and continuous delivery (CI/CD), and other situations where images are pulled without using a Docker image cache or where faster startup times are required.
How Did Microsoft Reduce the Image Size by 40 percent?
Windows Server Core images include a series of pre-compiled .NET native images that are generated using a tool called Ngen.exe to improve startup performance. But the downside is that it also makes image size grow. The current Insider Windows Server Core images now include a significantly smaller set of NGEN images. A larger set of images is included in the .NET Framework runtime images, also based on Server Core, but are also smaller because Microsoft makes sure that there is only one copy of each NGEN image that target ASP.NET and PowerShell performance.
Investigations started at Microsoft a year ago based on the premise that the way the .NET Framework is packaged and installed doesn’t work well with Docker layers. On the back of this research, Microsoft defined three criteria to reduce image sizes.
- There should be a single copy of each file in the .NET Framework, across all container image layers published by Microsoft.
- NGEN images that are created by default should align with default use cases.
- Maintain startup performance as container image size is reduced.
Decreasing image size and maintaining startup performance was the biggest challenge as NGEN was the culprit for increased image size. To achieve its goals for the Windows Server Core base image layer, Microsoft made the following changes:
- Included a serviced copy of .NET Framework 4.8.
- Removed all NGEN images, except for mscorlib.dll, System.dll and System.Core.dll (32-bit and 64-bit).
In the .NET Framework runtime image layer, the changes are as follows:
- Included NGEN assemblies used by Windows PowerShell and ASP.NET only.
- Included only NGEN 64-bit assemblies.
The images are currently available for Insiders here at the windows/servercore/insider repo but should be generally available in the windows/servercore repo when Windows 10 20H1 becomes generally available in the first half of 2020. Microsoft says that container images needing best performance for .NET Framework or Windows PowerShell should use the dotnet/framework/runtime repo. While the images are bigger, they offer better performance.
More in Windows Server
Microsoft to Fix Windows Bug Breaking Wi-Fi hotspots After Installing Latest Patch Tuesday Update
Jun 17, 2022 | Rabia Noureen
Microsoft Confirms Windows Server Backup Issues in This Month's Patch Tuesday Updates
Jun 16, 2022 | Rabia Noureen
Microsoft Acknowledges Office Zero-Day Flaw Affecting Windows Diagnostic Tool
May 31, 2022 | Rabia Noureen
Microsoft Releases Out-Of-Band Patches to Fix Windows AD Authentication Issues
May 20, 2022 | Rabia Noureen
CISA Warns Windows Admins Against Applying May Patch Tuesday Updates on Domain Controllers
May 17, 2022 | Rabia Noureen
Microsoft Confirms May 2022 Patch Tuesday Updates Cause AD Authentication Issues
May 12, 2022 | Rabia Noureen
Most popular on petri