Why nested virtualization for the Android emulator is very very slow?
Asked Answered
P

3

7

Nested KVM virtualization should have a small overhead, but an Android emulator inside a VM should be usable.

When I launch the Android emulator inside ubuntu 20.04 guest (on ubuntu 20.04 host), it warns me that I'm on a nested virtualization and thus it will be slow. But it's painfully low, not just slow. It takes 10 minutes to boot into Android and yes, all the systems are x86_64, even the android image.

I thought this had to do with OpenGL so I enabled OpenGL virtualization on my virt-manager and things are still slow.

I tried the same thing on my Ryzen 7 2700x which has 16 cores, I gave all cores to the VM and passed an AMD gpu to it, and Android emulator is also painfully slow.

Why?

Paperback answered 11/7, 2021 at 19:37 Comment(0)
A
3

For KVM one likely first has to enable nested virtualization; preferably with a x86 image:
https://docs.fedoraproject.org/en-US/quick-docs/using-nested-virtualization-in-kvm/
And even then, it's probably more effective to run a QEMU and connect through IP.

Architrave answered 12/2, 2022 at 22:40 Comment(0)
B
2

The problem is with QXL. Somehow it's slow on the new Ubuntu. Use VirtIO video and possibly 3D acceleration

Basilicata answered 13/2, 2022 at 0:2 Comment(0)
N
1

You can try anbox instead of a VM. Performance overhead is much lower as anbox is less like a VM & works more like wine. To explain it with their own words:

The emulator(like a VM) creates an entire emulated system which has its own kernel etc whereas Anbox runs the Android system under the same kernel as the host operating system does. No emulation layer like QEMU is necessary. Everything runs directly on the hardware. This approach also allows a much better integration with the host operating system.

anbox.io

I gotta warn you tho, it's a bit chunky and software support is not the greatest. Had to manually install Kernel Modules from a github issue report as they didn't fix the focal ppa repository. Also some software runs barely or not at all so jeeaah...

Novocaine answered 19/7, 2021 at 1:18 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.