Nested virtualization - Poor Performance

Discussion in 'General Questions' started by DamienB2, Jun 11, 2020.

  1. DamienB2

    DamienB2 Member

    Messages:
    32
    Hi all,

    Anyone else seeing poor performance with anything that involves nested virtualization? Docker, WSL2, Ubuntu Multipass, Windows Sandbox etc...

    I tried Docker and Multipass ages ago but noticed such a dramatic drop in performance that I immediately uninstalled them. Now just run them on the macOS side. I've been using WSL for some time now and wanted to switch over to WSL2 which involves nested virtualization. When running a WSL2 shell, the performance of the VM drops noticeably. More recently I have had reason to try Windows Sandbox. I can't even get that start. The VM grinds to a halt.

    Mac specs are 2.4Ghz 8-core processor, 64GB RAM. The VM has 8-cores (hyperthreading) which is recommended and 16GB RAM. I have tried increasing the VM RAM up to 32GB but I actually find this makes the VM performance even worse. Strange!?!

    Interestingly, all of this works fine in VMware Fusion.
     
  2. Ajith1

    Ajith1 Parallels Support

    Messages:
    2,719
    Try creating a new virtual machine from scratch and make the configuration changes before installing Windows then check.
     
  3. DamienB2

    DamienB2 Member

    Messages:
    32
    I have already tried this using the Windows development image. No difference. Still completely poor performance.
     
  4. DamienB2

    DamienB2 Member

    Messages:
    32
    I have been having performance issues with v15 in general. Sluggish behaviour. Slow startups. VM unusable for 5-10 minutes after starting up. I wrote about it in a reply to another post recently.

    But now on top of that, it seems that whenever you try to add any form of nested virtualization into the mix, Parallels simply isn't good enough to deal with it.
     
  5. Hello, please configurations -> CPU and Memory -> and let us know what kind of hypervisor has been used.
    Thanks in advance.
     
  6. DamienB2

    DamienB2 Member

    Messages:
    32
    It's using the Parallels Hypervisor.

    For now, I have had to completely disable nested virtualization in the VM configuration as it was having a negative impact on my VM, even if I wasn't using any nested virtualization applications.
     
  7. Could you please also try to change the Hypervisor to Apple and check the issue.
     
  8. Roland07

    Roland07 Junior Member

    Messages:
    18
    What version of Parallels are you using? You mention nested hypervisors but I know Parallels Desktop (the consumer version) does not support that, so some software does it internally and then it runs hog-slow...​
     
  9. BenjaminD4

    BenjaminD4 Bit poster

    Messages:
    9
    I'm running Parallels Desktop 15 Pro and I've definitely been seeing nested virtualization is sluggish. My machine is a Mac Pro with 16 cores (32 threads) and 96 GB of ram. Startup time for my Win 10 virtual machine is probably 2 or 3 *minutes* with nested virtualization turned on.

    I haven't exhaustively tested this but I think that the more cores that I allocate to the VM, the slower it gets.

    Considering that WSL2 is a "thing" now and requires nested virtualization, hopefully this is something that Parallels can fix/improve.
     
  10. DaveP9

    DaveP9 Bit poster

    Messages:
    1
    I've been experiencing the same issue. The guest regularly becomes unresponsive and the host does too, from time to time even though it's showing minimal CPU usage and a few GB free memory.

    MacBook Pro 15" 2019, 2.3 GHz 8-Core i9, 32 GB memory
     
  11. Hello,
    Host and VM performance decreasing is expected when you're using nested virtualization.
    Because it is virtualization within virtualization.
    Please let us know if you have any additional questions.
     
  12. BenjaminD4

    BenjaminD4 Bit poster

    Messages:
    9
    Hi Maria --

    Thanks for the reply. It's great that Parallels is finally weighing in on this.

    I think it's safe to assume that the people (me included) who are complaining about decreased performance with nested virtualization understand that there would be some performance penalty. The kind of performance penalty that we're describing isn't merely a 5% decrease...it's quite a bit more than that. I doubt that Parallels thinks that checking that "allow nested virtualization" checkbox means "make my VMs insanely slow". WSL2 is a pretty darned important developer feature in Windows 10 and it requires virtualization to run so getting a reply from Parallels that says what you said isn't all that helpful or encouraging.

    It kinda sounds like you're saying something like "Parallels doesn't think that WSL2 is a valid use case and we don't intend to support it." Is that accurate?

    Thanks,
    -Ben
     
    JaehongK likes this.
  13. SvenS14

    SvenS14 Bit poster

    Messages:
    1
    Hi, I also have horrible performance when enabling nested virtualisation. What I've figured out, it looks like that the cpu cores are not correctly used. If I open a browser window it took all 8 cores on 100%.
    Also strange, The CPU Usage sometimes increase up to 120%. This is unusual for windows systems.
    I need to use docker for windows, and If I stop the docker engine the performance is a little bit better.

    iMac 2017
    Quad-Core Intel Core i7 4,2 Ghz 64 GB RAM
    VM: Windows 10 32 GB RAM 8 Cores Hypervisor Parallels



    upload_2020-10-14_8-49-24.png
     
    MichaelS115 and JaehongK like this.
  14. DamienB2

    DamienB2 Member

    Messages:
    32
    I'm now on PD 16.1. I am seeing poor VM performance with nested virtualization off. God knows what it would be like with it turned on. I'm running the latest macOS Big Sur Public Beta. At the minute I'm on the Parallels hypervisor but I think the Apple one offers better performance. On the Parallels one I'm experiencing an issue at the minute where the VM freezes every so often for about 5 seconds (every 5-10 minutes maybe). No spinning wheel or anything like that. Mouse, keyboard, nothing works for about 5 seconds each time. It's quite frustrating. I'm going to switch back to the Apple hypervisor to see if that problem goes away.

    I think what @BenjaminD4 said hit the nail on the head. Anyone who wants to use nested virtualization understands that it's going to come at a slight performance cost. But it shouldn't render the VM un-usable. However, a VM with 8 cores and 32Gb RAM available to it ceases to function properly when using nested virtualization to work with WSL2 or Docker containers. That can't be right.
     
  15. EnzoA

    EnzoA Bit poster

    Messages:
    1
    Weighting in to confirm the issue. Using KVM in an Ubuntu guests hogs all CPU cores available (8 in my case) and renders the guest barely usable.
     
  16. DamienB2

    DamienB2 Member

    Messages:
    32
    I've been using the Apple hypervisor since my last post and to be honest the performance has been OK with that. No nested virtualization though.

    I tried switching back to the Parallels hypervisor today as it happens to give WSL2 another go now that Big Sur has been released officially. Switched to Parallels hypervisor, enabled nest virtualization, booted up Windows, and enabled Virtual Machine Platform. Restarted then proceeded to convert my WSL distros from version 1 to version 2. Still no good. I don't know if it's me and I'm now just expecting it to be poor, so it is poor??? But I can't help but feel the performance is dramatically decreased when using WLS2. The WSL shells start to lag during typing and VS code really was so slow to start or do anything. CPU usage goes crazy when trying to the littlest of things.

    I've already switched back to WSL1 and turned the Virtual Machine Platform off in Windows. The difference feels like night and day, to me at least. Still currently on the Parallels Hypervisor with nested virtualization on and it feels OK so might see how it fairs for a bit before jumping back to the Apple hypervisor.
     
  17. DamienB2

    DamienB2 Member

    Messages:
    32
    Thought I would post an update as I think I have finally found a solution to this.

    I have managed to get WSL2 under control by using a .wslconfig file placed in my user directory.

    The contents of the file being something like this:
    Code:
    [wsl2]
    kernel=C:\\temp\\myCustomKernel
    memory=4GB # Limits VM memory in WSL 2 to 4 GB
    processors=2 # Makes the WSL 2 VM use two virtual processors
    
    I'm not using a custom kernel so I have that commented out. My file looks like this:
    Code:
    [wsl2]
    #kernel=C:\\temp\\myCustomKernel
    memory=2GB
    processors=1
    

    The second thing I have done is place a wsl.conf in /etc/ in each distro. This is to per distro config. Its purpose is to remove the Windows path variables from $PATH as this was causing me some trouble using oh-my-zsh. You may not need to do this if you are using bash.

    The contents of the file look like this:
    Code:
    [interop]
    appendWindowsPath = false
    

    Further information on these files and further configuration options can be found at https://docs.microsoft.com/en-us/windows/wsl/wsl-config.

    Thanks,

    D
     
  18. JaehongK

    JaehongK Bit poster

    Messages:
    4
    Yeah, It's toooo slow compared to VMWare Fusion which supports nested virtualization with Apple hypervisor. I hope Parallels solve this issue.
     
  19. JaehongK

    JaehongK Bit poster

    Messages:
    4
    Oh, I found what causes this issue.
    If VM allocated vProcessor more than host's physical cores, It's too slowed.
    (Ex: Host - (4C/8T), VM - 8 vProcessor)
    If VM allocated cores same or lower than host's physical cores, than fine.
    (Ex: Host - 4C/8T, VM - 4 vProcessor)
     
  20. RimantasJ

    RimantasJ Bit poster

    Messages:
    2
    Hi, I have a question: if I enable nested virtualization option in the parallels VM settings, and if in particular time I will not be using any guest OS, docker, etc., will performance still be decreased on my VM? I'm asking this because I plan sometimes to play some games on win10.
     

Share This Page