firecracker-microvm / firecracker

Secure and fast microVMs for serverless computing.
http://firecracker-microvm.io
Apache License 2.0
26.17k stars 1.81k forks source link

Page fault about firecracker #2931

Closed thunderZH963 closed 1 year ago

thunderZH963 commented 2 years ago

As firecracker said, it is implemented based on KVM. Then, the processing of page fault should be consistent with KVM / QEMU. But in my test, the delay of page fault in microVM is lower than QEMU / KVM VM. Why?

Hope to get a reply and discussion.

Thanks.

thunderZH963 commented 2 years ago

I can observe "let memory_region = kvm_userspace_memory_region{...}" in firecracker/src/vm.rs

or maybe other codes indicate "page fault handler"?

JonathanWoollett-Light commented 1 year ago

But in my test, the delay of page fault in microVM is lower than QEMU / KVM VM. Why?

If you can provide the failing test case we would be interested to take a look.

thunderZH963 commented 1 year ago

But in my test, the delay of page fault in microVM is lower than QEMU / KVM VM. Why?

If you can provide the failing test case we would be interested to take a look.

The cases shown in below and the results also are shown.

lat/us | micro fork+exit | micro fork+execve | micro fork+shell | micro pipe | micro mmap-write | micro mmap-read | lmbench fork+exit | lmbench fork+execve | lmbench fork+shell | lmbench pipe | lmbench mmap-write | lmbench mmap-read | lmbench pagefault -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- | -- Baremetal | 93.335 | 315.87 | 812.01 | 1.52 | 43.177 | 16.812 | 98.1964 | 328.875 | 807.7143 | 5.0492 | 15.823 | 6.42 | 0.25 KVM | 108.284 | 540.135 | 1825.631 | 1.629 | 47.932 | 32.9 | 113.08 | 465.1818 | 1770.3333 | 5.66 | 17.022 | 10.1 | 1.18 Firecracker | 99.57 | 517.164 | 1033.429 | 1.576 | 43.207 | 17.36 | 100.5926 | 355.625 | 842.3846 | 5.1561 | 17.021 | 9.56 | 0.31
roypat commented 1 year ago

Hi @thunderZH963, We do not maintain comparisons with QEMU/other virtualization technologies, so we do not know why you observe these performance differences. Firecracker is more lightweight than QEMU, so I would expect this difference in complexity to play a role. I'm converting this issue to a discussion in case other community members would like to chime in on this :)