The Quest For Process Isolation, Part 1, or: "Help! My Sitecore Containers are melting my computer!"

 Introduction

Those of you already developing Sitecore and Sitecore Experience Commerce on Containers may find the following screen familiar:

as well as:

In summary, you have run docker-compose and now find your machine sluggish, CPU fan running full blast and, if you are using a laptop, so hot that you find it uncomfortable to use on your lap. Excessive consumption of CPU cycles and memory are causing your machine to grind to a halt. Throw in a Visual Studio IDE and you might end up waiting a lot of time to do anything with your development set up.

Reviewing the DevEx Containers Documentation, it is stated that 32GB of RAM and a quad core or higher CPU is recommended. Additionally, 25GB of SSD-class storage is required.

My personal experiences suggest that you wouldn't want anything less than what is stated, meaning that these should instead be considered as minimum requirements, especially if you plan to use the default Windows Container isolation mode - Hyper-V. Microsoft has a good article that explains what the different isolation modes mean.

Essentially, if you plan to run any of the Sitecore scaled topologies such as XP1 and XC1, be prepared to find your system running up to 24 Hyper-V virtual machines simultaneously, all with their own individual memory and CPU requirements. If you only have a quad-core CPU, with Hyper-threading if you have an Intel Core i7 processor, you will be oversubscribing your CPUs available threads by three times (8 threads or 24 virtual machines).

In this post I will discuss what I really think it takes to run a development environment for Sitecore on containers, plus how to increase the performance of it and make the most of your system resources.

The Real System Requirements

It is obviously clear with the Hyper-V Container isolation mode, there is a great amount of resource wastage with this approach. My revised unofficial system requirements for Sitecore development with Containers with Hyper-V isolation are as follows:

Sitecore Experience Platform development

  • CPU: Intel Core i7-8700 (Coffee Lake or better), 6 cores / 12 threads SMT
  • RAM: 32GB
  • Storage: 100GB of SSD-class storage. NVMe SSD a bonus

Sitecore Experience Commerce development

  • CPU: 
    • Intel Core i7-7820X (Skylake-X or better), 8 cores / 16 threads SMT
    • AMD Ryzen 7 2000 series or better, 8 cores / 16 threads SMT
    • Processors that do not support SMT / Hyper-threading such as Core i7-9700 are not recommended as you only get the same number of threads as CPU cores.
  • RAM: 48GB
  • Storage: 200GB of SSD-class storage. NVMe SSD a bonus
It is not recommended to run your Docker containers out of traditional hard disk drive storage as it will quickly become overwhelmed with simultaneous I/O operations.

Optimising Docker container performance

You might ask, "those are extremely high system requirements!", to which I replay "You Gotta Pay To Play". You can certainly get away with a lesser system, but once you load it up with your IDE and other development tools, you may find yourself with system responsiveness issues and general unpleasantness. The specifications I quote above are what you will reasonably require to avoid going on a coffee run every time you run a build.

There Is Another Way™. By using the Process Isolation mode, you can get away with less. Quad cores for XP1 development, Hexa core for XC1 development, etc. I myself have a 10 year old workstation with 12 cores that runs like trash with Hyper-V but screams under Process Isolation.

Thus I think it's important to share my methodology which will no doubt help people develop more efficiently. The Sitecore documentation mentions it, but doesn't go into much more detail other than "You need Windows 1909". That is not quite specific enough and you will have trouble using Windows 10 1909 as the host operating system.

How to use Process Isolation

If you would like to use the Sitecore 10.0 Container images provided by the official container registry, there are only three currently supported operating systems / base images:
  • Windows Server 2019, a.k.a. ltsc2019
  • Windows Server Core 1903
  • Windows Server Core 1909
Any other base image type and you will need to be building your own images.


To change isolation mode is quite simple. If you followed the installation instructions you should already have an .env file in the same directory as your docker-compose.yml file. Update the following environment variables:

XP_SITECORE_TAG=10.0.0-1909
SPE_SITECORE_TAG=6.1.1-1909
SXA_SITECORE_TAG=10.0.0-1909
XC_PACKAGES_TAG=10.0.0-1909
ISOLATION=process

As you can see I have configured my docker-compose.yml to point to the 1909 images and to use Process isolation. Next step would be to run docker-compose up right?

Not quite.

Unfortunately, Windows Containers currently has very strict rules around the use of this feature. In practice, your host operating system must be the same OS version as the base image you are trying to run.

This means that you cannot even use Windows 10 1909 to run a container based on Windows Server Core 1909. This is complicated by the fact that Windows Server Core is just that, it is unrealistic to use as a host OS for development has it has no graphical interface and you can't install one. This leaves Windows Server 2019 as the only operating system you can use for both development and for process isolation Containers. In the future, when version 2004 is officially supported by Sitecore, and Azure in Azure Kubernetes Service, you will be able to use Windows 10 as the host OS for development. It will be compatible for Process Isolation with Windows Server 2004. See this documentation from Microsoft for information about compatibility.

The solution for the issue we are talking about here is to install a virtual machine running Windows Server 2019 with Docker Enterprise. You could also use an Azure Virtual Machine with the same operating system, but make sure you select a machine type that supports Hyper-threading and nested virtualisation.


But what if:
  • You run a virtual machine with your development environment inside and already have another version of Windows in that virtual machine?
  • You do not want to run a 2 year old operating system (Windows Server 2019). Recent versions of Windows 10 come with a large number of enhancements and usability improvements.
In the next post I will talk about how to install Docker on a virtual machine so you can separate it from the rest of your development environment.

Summary

In this post we talked about how running Sitecore in Hyper-V Containers results in wasted system resources. To use Process Isolation is a challenge with the officially provided repositories as you would need to install Windows Server 2019 as the host operating system. 

In the next post I will cover how I installed Docker in a Windows Server Core 1909 Virtual Machine and discuss the benefits of doing so.

    Comments