dockur / windows

Windows inside a Docker container.
MIT License
29.22k stars 1.99k forks source link

[Feature]: Dynamic RAM allocation for Windows VM #751

Open MopigamesYT opened 1 month ago

MopigamesYT commented 1 month ago

Is your proposal related to a problem?

I'm always frustrated when the Windows VM uses all the allocated RAM even when it doesn't need it. For example, if I allocate 4GB of RAM to the VM, it uses all 4GB even if Windows only needs 2GB, wasting resources that could be used by other processes on my host system.

Describe the solution you'd like.

I'd like the RAM_SIZE parameter to act as a maximum limit rather than a fixed allocation. The VM should only use the amount of RAM it actually needs, up to the RAM_SIZE limit. Unused RAM should be released back to the host system. For instance, if RAM_SIZE is set to 4GB and Windows only needs 2GB, it should only use 2GB, leaving the other 2GB available for the host system.

Describe alternatives you've considered.

  1. Manually adjusting RAM_SIZE: This requires constant monitoring and container restarts, which is inconvenient.
  2. Using a smaller fixed RAM size: This could lead to performance issues when the VM occasionally needs more RAM.

Additional context

This feature would allow users to set a higher RAM_SIZE for peak usage without constantly reserving that amount, leading to more efficient use of system resources and improved overall system performance. It might involve changes to how QEMU and virtio-balloon are configured and managed within the container.

ornago commented 1 month ago

I'm running five of these windows containers simultaneously and it would be really nice, if they would share the RAM. With my Server having 32G of RAM installed, I can only allocate 10G for my containers. Is there a workaround?

lmargit commented 1 month ago

About the " ...RAM_SIZE parameter to act as a maximum limit rather than a fixed allocation". I think this is one of the features built-in of using windows in a docker instead of windows in the traditional VM. Right? You may compare the use of memory RAM in your Linux instance (host) using windows the traditional VM method vs the Dockur/windows method (Docker). Of course, same amount of RAM memory allocated to the Windows VM.

Or it is referring to change the amount of RAM memory inside the windows VM itself (on-the-fly)?