Show HN: Smol machines – subsecond coldstart, portable virtual machines
Posted by binsquare 11 hours ago
Comments
Comment by binsquare 11 hours ago
I worked in AWS previously in the container space + with firecracker. I realized the container is an unnecessary layer that slowed things down + firecracker was a technology designed for AWS org structure + usecase.
So I ended up building a hybrid taking the best of containers with the best of firecracker.
Let me know your thoughts, thanks!
Comment by PufPufPuf 9 hours ago
My problem with microVMs was that they usually won't run docker / kubernetes, I work on apps that consist of whole kubernetes clusters and want the sandbox to contain all that.
Does your solution support running k3s for example?
Comment by fqiao 8 hours ago
Really appreciate the feedback!
Comment by topspin 9 hours ago
That's the one feature of similar systems that always gets left out. I understand why: it's not a priority for "cloud native" workloads. The world, however, has work loads that are not cloud native, because that comes at a high cost, and it always will. So if you'd like a real value-add differentiator for your micro-VM platform (beyond what I believe you already have,) there you go.
Otherwise this looks pretty compelling.
Comment by genxy 8 hours ago
By what I assume is your definition, there are plenty of "non cloud native" workloads running on clouds that need live migration. Azure and GCP use LM behind the scenes to give the illusion of long uptime hosts. Guest VMs are moved around for host maintenance.
Comment by topspin 8 hours ago
As does OCI, and (relatively recently) AWS. That's a lot of votes.
Use case: some legacy database VM needs to move because the host needs maintenance, the database storage (as opposed to the database software) is on a iSCSI/NFS/NVMe-oF array somewhere, and clients are just smart enough to transparently handle a brief disconnect/reconnect (which is built-in to essentially every such database connection pool stack today.)
Use case: a web app platform (node/spring/django/rails/whatever) with a bunch of cached client state needs to move because the host needs maintenance. The developers haven't done all the legwork to make the state survive restart, and they'll likely never get time needed to do that. That's essentially the same use case as previous. It's also rampant.
Use case: a long running batch process (training, etc.) needs to move because reasons, and ops can't wait for it to stop, and they can't kill it because time==money. It's doesn't matter that it takes an hour to move because big heap, as long as the previous 100 hours isn't lost.
"as in how large the heap is"
That's an undecidable moving target, so let the user worry about it. Trust them to figure out what is feasible given the capabilities of their hardware and talent. They'll do fine if you provide the mechanism. I've been shuffling live VMs between hosts for 10+ years successfully, and Qemu/KVM has been capable of it for nearly 20, never mind VMware.
"CRIU"
Dormant, and still containers. Also, it's re-solving solved problems once you're running in a VM, but with more steps.
Comment by fqiao 9 hours ago
Thanks
Comment by topspin 9 hours ago
virsh migrate --live GuestName DestinationURL
This is feasible when network storage is available and useful when a host needs to be drained for maintenance.Comment by benswerd 4 hours ago
My team spent 4 months on our implementation of vm memory that let us do it and its still our biggest time suck. We also were able to make assumptions like RDMA that are not available.
All that to say — as someone not working on smolVMs — I am confident smolVMs and most other OSS sandbox implementations will get live migration via hypervisor upgrades in the next 12 months.
Until then there are enterprise-y providers like that have it and great OSS options that already solve this like cloud hypervisor.
Comment by fqiao 8 hours ago
Comment by sureglymop 6 hours ago
Comment by lacoolj 7 hours ago
Comment by binsquare 7 hours ago
Not useful for things it hadn't been trained on before. But now I have the core functionality in place - it's been of great help.
Comment by RALaBarge 6 hours ago
Comment by anthk 5 hours ago
Comment by weird-eye-issue 5 hours ago
Comment by harshdoesdev 11 hours ago
Comment by sahil-shubham 10 hours ago
I have been working on something similar but on top of firecracker, called it bhatti (https://github.com/sahil-shubham/bhatti).
I believe anyone with a spare linux box should be able to carve it into isolated programmable machines, without having to worry about provisioning them or their lifecycle.
The documentation’s still early but I have been using it for orchestrating parallel work (with deploy previews), offloading browser automation for my agents etc. An auction bought heztner server is serving me quite well :)
Comment by harshdoesdev 9 hours ago
also, yes, shuru was (still) a wrapper over the Virtualization.framework, but it now supports Linux too (wrapper over KVM lol)
Comment by fqiao 11 hours ago
Comment by BobbyTables2 1 hour ago
Comment by binsquare 1 hour ago
smolvm is a vm with some of the properties & ergonomics of containers - it's meant as a replacement for containers.
Comment by thepoet 4 hours ago
Comment by JuniperMesos 6 hours ago
Comment by binsquare 6 hours ago
Linux was built in the 90s. Hardware improved more than a 1000x. Linux virtual machine startup times stayed relatively the same.
Turns out we kept adding junk to the linux kernel + bootup operations.
So all I did was cut and remove unnecessary parts until it still worked.
This ended up also getting boot up times to under 1s. The kernel changes are the 10 commits I made, you can verify here: https://github.com/smol-machines/libkrunfw
There's probably more fat to cut to be honest.
Comment by thm 10 hours ago
Comment by fqiao 10 hours ago
Comment by sdrinf 10 hours ago
Comment by fqiao 10 hours ago
Comment by binsquare 10 hours ago
WSL2 runs a linux virtual machine. Need to take some time and care to wire that up, but definitely feasible.
Comment by gavinray 10 hours ago
Probably a lot of other neat usecases for this, too
smolvm pack create --image python:3.12-alpine -o ./python312
./python312 run -- python3 --version
# Python 3.12.x — isolated, no pyenv/venv/conda neededComment by binsquare 9 hours ago
Electron ships your web app bundled with a browser.
Smol machines ship your software packaged with a linux vm. No need for dependency management or compatibility issues because it is baked in.
I think this is how Codex or Claude Code should be shipped by default, to avoid any isolation issues tbh
Comment by fqiao 7 hours ago
Comment by mrbluecoat 8 hours ago
Comment by cr125rider 11 hours ago
Nice job! This looks really cool
Comment by fqiao 11 hours ago
Comment by lambdanodecore 9 hours ago
Comment by binsquare 9 hours ago
Comment by lambdanodecore 9 hours ago
Also libkrun is not secure by default. From their README.md:
> The libkrun security model is primarily defined by the consideration that both the guest and the VMM pertain to the same security context. For many operations, the VMM acts as a proxy for the guest within the host. Host resources that are accessible to the VMM can potentially be accessed by the guest through it.
> While defining the security implementation of your environment, you should think about the guest and the VMM as a single entity. To prevent the guest from accessing host's resources, you need to use the host's OS security features to run the VMM inside an isolated context. On Linux, the primary mechanism to be used for this purpose is namespaces. Single-user systems may have a more relaxed security policy and just ensure the VMM runs with a particular UID/GID.
> While most virtio devices allow the guest to access resources from the host, two of them require special consideration when used: virtio-fs and virtio-vsock+TSI.
> When exposing a directory in a filesystem from the host to the guest through virtio-fs devices configured with krun_set_root and/or krun_add_virtiofs, libkrun does not provide any protection against the guest attempting to access other directories in the same filesystem, or even other filesystems in the host.
Comment by fqiao 7 hours ago
for virtio-fs, yes the risk of exposing the host fs struture exists, and we plan to:
1. creating staging directory for each vm and bind-mount the host dir onto them
2. having private mount namespaces for vms
they are both tracked in our github issues:
https://github.com/smol-machines/smolvm/issues/152 https://github.com/smol-machines/smolvm/issues/151
2 may need much more efforts than we imagine, but we will ensure to call this out in our doc.
For the concern around TSI, we are developing virtio-net in-parallel, it is also tracked in our github and will be released soon: https://github.com/smol-machines/smolvm/issues/91
Would like to collect mroe suggestions on how to make this safer. Thanks!
Comment by binsquare 7 hours ago
Here's how my perspective:
smolvm operates on the same shared responsibility model as other virtual machines.
VM provides VM-level isolation.
If the user mounts a directory with the capability of symlinks or a host OS with a path for guest software that is designed to escape - that is the responsibility of the user rather than the VM.
Security is not guaranteed by using a specific piece of software, it's a process that requires different pieces for different situations. smolvm can be a part of that process.
Comment by genxy 8 hours ago
Would you be ok with a trampoline that launched the VM as a sibling to the Vagrant VM?
Comment by chwzr 6 hours ago
Looks really nice btw. Hot resize mem/cpu would be nice. This could become a nice tech for a one-backend-per-customer infra orchestrator then.
Comment by simonreiff 7 hours ago
Comment by fqiao 7 hours ago
Cheers!
Comment by sureglymop 6 hours ago
Comment by binsquare 4 hours ago
I'm trying to do away the model of cpu and memory tbh.
Virtio- balloon dynamically resizes based on memory consumed.
CPU is oversubscribed by default
Comment by akoenig 9 hours ago
I’m currently evaluating smolvm for my project, https://withcave.ai, where I’m using Incus for isolation. The initial integration results look very promising!
Comment by indigodaddy 6 hours ago
Comment by fqiao 8 hours ago
Comment by brianjlogan 4 hours ago
Comment by binsquare 4 hours ago
But should be easy for anyone to build their own integration with existing as well like nomad.
Comment by irickt 8 hours ago
Comment by binsquare 7 hours ago
I build a virtual machine that is an alternative to firecracker and containers.
Comment by rkagerer 8 hours ago
Comment by binsquare 5 hours ago
Comment by ukuina 9 hours ago
Comment by binsquare 9 hours ago
I'm building a different virtual machine.
Comment by ccrone 5 hours ago
Comment by 0cf8612b2e1e 10 hours ago
Can you pipe into one? It would be cute if I could wget in machine 1 and send that result to offline machine 2 for processing.
Comment by binsquare 10 hours ago
Yes! GPU passthrough is being actively worked on and will land in next major release: https://github.com/smol-machines/smolvm/pull/96
Yea just tried piping, it works:
``` smolvm machine exec --name m1 -- wget -qO- https://example.com/data.csv \ | smolvm machine exec --name m2 -i -- python3 process.py ```
Comment by timsuchanek 7 hours ago
Comment by isterin 9 hours ago
Comment by fqiao 9 hours ago
Comment by bch 10 hours ago
*yes, FreeBSD is specifically developed against Firecracker which is specifically avoided w "Smol machines", but interesting nonetheless
[0] https://github.com/NetBSDfr/smolBSD
[1] https://www.usenix.org/publications/loginonline/freebsd-fire...
Comment by binsquare 9 hours ago
microvm space is still underserved.
Comment by bch 9 hours ago
Colins FreeBSD work or Emiles NetBSD work?
Comment by binsquare 6 hours ago
You'll see that philosophy in this project as well (i hope).
freeBSD focuses on features, which is great too.
Comment by akdev1l 4 hours ago
Comment by fqiao 11 hours ago
Cheers!
Comment by leetrout 10 hours ago
Edit: I see this appears to be a contributor to the project as well. It was not obvious to me.
Comment by fqiao 10 hours ago
@binsquare is this one: https://github.com/BinSquare
Comment by fqiao 7 hours ago
Comment by parasitid 9 hours ago
question: why do you report that qemu is 15s<x<30s? for instance with katacontainers, you can run fast microvms, and even faster with unikernels. what was your setup?
thanks a lot
Comment by nonameiguess 9 hours ago
Comment by binsquare 7 hours ago
Got a lot of questions on how I spin up linux VM's so quickly
Explanation is pretty straight forward.
Linux was built in the 90s. Hardware improved more than a 1000x. Linux virtual machine startup times stayed relatively the same.
Turns out we kept adding junk to the linux kernel + bootup operations.
So all I did was cut and remove unnecessary parts until it still worked. This ended up also getting boot up times to under 1s.
Big part of it was systemd btw.
Comment by binsquare 7 hours ago
Comment by chrisweekly 8 hours ago
Comment by fqiao 7 hours ago
Comment by messh 9 hours ago
Comment by tomComb 7 hours ago
So, if I use a "16 vCPUs, 32GB RAM, 400GB SSD" machine for a period of intense compute, and then want to scale that down to "2 vCPUs, 4GB RAM", most of my storage disappears?
That rather ruins the potential of the advertised scalability.
Comment by harshdoesdev 11 hours ago
Comment by fqiao 11 hours ago
Comment by deivid 10 hours ago
Though my version was only tested on Linux hosts
Comment by binsquare 10 hours ago
Comment by threecheese 7 hours ago
Comment by harshdoesdev 11 hours ago
Comment by fqiao 10 hours ago
Comment by dimitry12 5 hours ago
Comment by cperciva 9 hours ago
Comment by fqiao 8 hours ago
Comment by danelliot 7 hours ago
Comment by kevinten10 2 hours ago
Comment by volume_tech 5 hours ago
Comment by volume_tech 11 hours ago