windows icon indicating copy to clipboard operation
windows copied to clipboard

[Improvements] Enhance Windows performance

Open dannykorpan opened this issue 11 months ago • 5 comments

Hi,

It’s possible to further improve Windows performance if you enable hugepages (5.2) and enlightenments (2.3). More Infos could be found here: https://leduccc.medium.com/improving-the-performance-of-a-windows-10-guest-on-qemu-a5b3f54d9cf5#c5b9

Kind Regards, Danny

dannykorpan avatar Mar 10 '24 11:03 dannykorpan

Thanks, the funny thing is I already used that article to optimize the container. All Hyper-V enlightments are already enabled. That causes problems on some machines, but you can disable enlightments by setting HV: "N" in the compose file.

The only thing I did not add is hugepages support, because I read very conflicting opinions on wether it was a good idea or not. It seems to be very dependant on the actual machine if enabling it makes it faster or slower. So to be on the safe side, I did not implement that feature yet.

kroese avatar Mar 10 '24 11:03 kroese

Is it possible to add a docker environment variable and set the default to "no"?

dannykorpan avatar Mar 10 '24 11:03 dannykorpan

There already exists an environment variable to add extra QEMU parameters, so you can already use hugepages with something like:

  ARGUMENTS: "-mem-prealloc -mem-path /storage/hugepages/"

So adding an environment variable especially for hugepages would not change much, except that it could look like:

  HUGEPAGES: "/storage/hugepages/"

Which is only slightly shorter.

kroese avatar Mar 10 '24 11:03 kroese

I've tried it, with

ARGUMENTS: "-mem-prealloc -mem-path /storage/hugepages/"

But get this error in docker.

windows  | ❯ ERROR: qemu-system-x86_64: can't open backing store /storage/hugepages/ for guest RAM: Is a directory

My complete docker-compose.yml looks like this

version: "3"
services:
  windows:
    image: dockurr/windows
    container_name: windows
    devices:
      - /dev/kvm
    cap_add:
      - NET_ADMIN
    ports:
      - 8006:8006
      - 3389:3389/tcp
      - 3389:3389/udp
    stop_grace_period: 2m
    environment:
      VERSION: "ltsc10"
      RAM_SIZE: "12G"
      CPU_CORES: "6"
      DISK_SIZE: "256G"
      ARGUMENTS: "-mem-prealloc -mem-path /storage/hugepages/"
    volumes:
      - ./disks:/storage

dannykorpan avatar Mar 10 '24 11:03 dannykorpan

It expects it to be a file, and not a directory. So maybe create an empty file of 32 GB for example (by using the linux fallocate command) and then call it hugepages and remove the last slash so it reads -mem-path /storage/hugepages.

But I never worked with hugepages so I am also just guessing.

kroese avatar Mar 10 '24 11:03 kroese