Print this page
Monday, 22 February 2021 18:20

SAP ABAP Platform 1909, Developer Edition: WSL2 Memory/CPU Hogging Tip

Written by Fredrick Mumali
Rate this item
(0 votes)
“© 2020. SAP SE or an SAP affiliate company. All rights reserved.” “Used with permission of SAP SE”

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.


Memory usage

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.


Dynamically allocated resources for Docker

Here is a quick fix to enable you to control how much memory and CPU resources are taken up by the Docker.

  1. If your ABAP platform is running, stop it.
  2. Open a Windows terminal such as Powershell as administrator and shut down all instances of WSL.
    wsl --shutdown
  3. Run the following command in the same Windows terminal.
    notepad "$env:USERPROFILE/.wslconfig"​
  4. A notepad file (.wslconfig) should open. Enter the following and save the file.
  5. [wsl2] memory=26GB # Limits memory to docker in WSL 26GB processors=5 # Limits processors to 6
  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.


After limiting resources available for Docker

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.

Read 109 times