| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
原始链接: https://news.ycombinator.com/item?id=43622514
这个Hacker News帖子讨论了一篇2022年的文章,文章介绍了如何利用CodeSandbox的基础设施在2秒钟内克隆虚拟机(VM)。原作者CompuIves提供了他们进度的更新,包括使用userfaultfd绕过磁盘以实现更快的克隆,以及使用zstd压缩内存快照以实现更快的启动。 讨论随后深入探讨了内存克隆的安全性问题,特别是加密库中nonce重用的问题,如果熵没有立即刷新,这可能会导致漏洞。用户讨论了虚拟机与容器的优缺点,虚拟机技术适应现代需求的潜力以及实时进程迁移的挑战。几位评论者提到了现有的技术,例如VMware的vSphere Fault Tolerance和Google的实时迁移,这些技术执行类似的功能。最后,一位用户表达了对在线文章质量的失望,这些文章越来越多的是AI生成的,缺乏真实的基准测试。
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
First, we started cloning VMs using userfaultfd, which allows us to bypass the disk and let children read memory directly from parent VMs [1].
And we also moved to saving memory snapshots compressed. To keep VM boots fast, we need to decompress on the fly as VMs read from the snapshot, so we chunk up snapshots in 4kb-8kb pieces that are zstd compressed [2].
Happy to answer any questions here!
[1]: https://codesandbox.io/blog/cloning-microvms-using-userfault...
[2]: https://codesandbox.io/blog/how-we-scale-our-microvm-infrast...
reply