Muvm as a target?
We are currently optimizing performance of nixos running in muvm and have added quiet a few changes (some pending, some merged). TL;DR is that we are now under 500ms boot to app time with this code base: https://git.clan.lol/clan/munix
Now I have a different project where microvm is used, so it might become interesting to also add this to microvm.nix for some applications. @astro what do you generally thing about this idea?
Do you have any requirements on your side you want to see for such an integration.
I would like to have more control over virtio-{fs,block,net} than muvm seems to provide but a lib/runners/muvm.nix would not have to support the full range of options of the microvm module. No VMM other than qemu does that. :)
Are there any general changes which every vmm would benefit from?
Also in my experience, just disabling payload and removing everything from a microvm decreases it's boot time significantly. Also switching from cloud hypervisor to qemu also did a good boost. Maybe we are using some settings wrong, why feedback there is welcome.
Most of the boot time optimization are not necessarily related to muvm only. We tuned a lot in systemd configuration to get time back i.e userborn and writing the activation in Rust.
However muvm has some unique features such as support for native context. This allows to share your host gpu with little overhead with a virtual machine. For headless VMs this might be for example useful for video encoding. Or you can have your browser inside a vm for extra security.
I would like to have more control over virtio-{fs,block,net} than muvm seems to provide but a
lib/runners/muvm.nixwould not have to support the full range of options of the microvm module. No VMM other than qemu does that. :)
I wasn't actually planning on porting our exact wrapper to microvm.nix. but a less opinionated version that is closer to the cli. Potentially replacing bubblewrap with a systemd chroot. I mainly pointed to the project because of our upstream patches to get everything to work. We still might have to wait a little to get all patches in to it. I.e. we added systemd support in https://github.com/AsahiLinux/muvm/pull/202
Sounds overall good to me
General optimizations should go into nixos-modules/microvm/optimization.nix from which users can opt out via microvm.optimize.enable = false;