Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
Mumali
Participant
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.

Memory/CPU hogging


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


 

Solution


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



Conclusion


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.
1 Comment