SAP ABAP Platform 1909, Developer Edition is finally available and Thomas Jung has simplified the process of installing on a Windows laptop in his latest article SAP ABAP Platform 1909, Developer Edition: Day 1 Experience and Tips and Tricks. In this post, I want to share a simple trick to a common challenge when running Docker on WSL2. As stated by Thomas, there is no sizing option when installing SAP ABAP Platform 1909, Developer Edition on Docker with WSL2 as the backend.
WSL2 has an in-built dynamic memory and CPU allocation feature designed to improve resource sharing with the host OS. As such, Docker can utilize only the required memory and CPU. This implies that other CPU and memory-intensive processes are not constrained. Despite improved resource consumption, Docker on WSL-2 often allocates all of the available memory at the host OS’s expense.
Checking the amount of available memory in docker shows the system has allocated more memory than needed. In case you are running other applications in Windows, they are likely to freeze. In my case, 49GB is allocated to the Docker even though only 26GB is in use.
Here is a quick fix to enable you to control how much memory and CPU resources are taken up by the Docker.
- If your ABAP platform is running, stop it.
- Open a Windows terminal such as Powershell as administrator and shut down all instances of WSL.
- Run the following command in the same Windows terminal.
- A notepad file (.wslconfig) should open. Enter the following and save the file.
[wsl2] memory=26GB # Limits memory to docker in WSL 26GB processors=5 # Limits processors to 6
- Restart your laptop and docker desktop instance.
If you now check the available memory for your Docker instance in WSL2, you will note that the allocated memory is below the limit you set in the .wslconfig file.
You can still run other programs that are heavy on memory/CPU usage alongside your ABAP Platform on Docker with WSL2 without having to wait for the dynamic resources allocation to release some of the resources back to the host OS.