‹ BackHN Continuity

Thread

5x faster Edge Functions: V8 isolates to Firecracker MicroVMs

229 points · 106 comments · jbott

  1. Normal_gaussian · · focus · HN ↗
    I've been using SlicerVM extensively - which is Firecracker MicroVMs for the regular person (and for the irregular with their platform offering) - to run local 'edge' style workloads locally and securly. Agents, local dev CI, etc. It slotted in and replaced my proxmox vm orchestrator, and now I have secure and and fast vms on my laptop wherever I go. It also supports dockerfile style builds if you're wanting a security upgrade from containers (which, you should if you're using agents).

    Honestly, while I see firecracker replacing docker on the horizon I don't see firecracker replacing v8 isolates for most edge function execution. Firstly, this article's scenario is a bit unusual in that they were using someone else's isolates - so adding on a few hops; secondly isolates running JS/TS can be statically analyzed quite well, and at scale looking historically for issues and exploits, in many edge compute scenarios this is quite desirable. MicroVMs can have an awful lot more flexibility so to get the same benefit you have to really lock down what is available - the trade-offs for mid-size companies seems to benefit isolates. Obviously netlify is more than big enough and relies heavily on this that it leans in their favour.

    1. jst1fthsdys · · focus · HN ↗
      25 USD/m to run a daemon on my own hardware. Yikes.
      1. binsquare · · focus · HN ↗
        That seems off to me as well.

        Fwiw, you can run this instead free and open source: <a href="https:&#x2F;&#x2F;github.com&#x2F;smol-machines&#x2F;smolvm" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;smol-machines&#x2F;smolvm

        Disclaimer: Am author.

        1. QGQBGdeZREunxLe · · focus · HN ↗
          Brew tap: <a href="https:&#x2F;&#x2F;github.com&#x2F;smol-machines&#x2F;homebrew-tap" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;smol-machines&#x2F;homebrew-tap
        2. Cyph0n · · focus · HN ↗
          This looks amazing! The credential injection trick is particularly cool :)
        3. chrisweekly · · focus · HN ↗
          you beat me to it (I&#x27;m singing the praises of smolmachines.com &quot;smolvm&quot; microvms all over the place)
          1. binsquare · · focus · HN ↗
            Appreciate your support!
        4. dprkh · · focus · HN ↗
          Why is this better than just using Docker?
          1. binsquare · · focus · HN ↗
            Kernel level isolation.

            Functionality of criu built in so you can get rewind, pause, in an accessible manner.

            Embeddable (you can write JavaScript to programmatically use an isolated environment)

            Native performance on multiplatform + consistent experience across platforms.

            1. stavros · · focus · HN ↗
              This sounds great. By the way, does &quot;kernel-level isolation&quot; mean &quot;you have to allocate a chunk of RAM to this&quot;? Or is that CPU-level?

              EDIT: Ah, looks like it means &quot;runs its own kernel&quot;, not &quot;isolates at the kernel&quot; like Docker does.

              1. binsquare · · focus · HN ↗
                yes, separate kernels + virtualized hardware via hypervisor.

                containers are built on linux primitives &amp; so shares the kernel.

                1. stavros · · focus · HN ↗
                  Excellent, thank you. This is definitely useful to me.
        5. zmmmmm · · focus · HN ↗
          amazing!

          any point of comparison with microsandbox? [0]

          [0] <a href="https:&#x2F;&#x2F;github.com&#x2F;superradcompany&#x2F;microsandbox" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;superradcompany&#x2F;microsandbox

          1. binsquare · · focus · HN ↗
            I focus on building the best VM tech.

            Good sandboxing is a feature of a good VM.

            Outside of that I support GPU and enables something called branchable computing.

        6. Normal_gaussian · · focus · HN ↗
          Smolvm with it&#x27;s libkrun vmm provides significantly worse security positioning than slicervms use of firecracker, which leads to slicervm for any dangerous or secure workload.

          <a href="https:&#x2F;&#x2F;github.com&#x2F;libkrun&#x2F;libkrun" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;libkrun&#x2F;libkrun

          1. binsquare · · focus · HN ↗
            Libkrun and firecracker had similar foundations (Rust, KVM, rust-vmm).

            Firecracker has a long track record but has a lot of knobs and tunings to get the security right.

            smolvm&#x27;s serve mode confines each VMM by default with a seccomp allowlist, Landlock, a per-VM uid and no_new_privs, much like Firecracker&#x27;s jailer.

            For dangerous workloads, people can do the same things such as skip host mounts and use virtio-net.

            It&#x27;s not a different security class just because it&#x27;s libkrun vs firecracker

        7. tomjen3 · · focus · HN ↗
          That is so effing cool — my only fear with it is whether you could turn it into a sustainable business, because I want that project to be around for a long time.
          1. binsquare · · focus · HN ↗
            I&#x27;ll keep it going just for you
      2. QGQBGdeZREunxLe · · focus · HN ↗
        I think Alex learned his lesson offering a free version running OpenFaaS.
        1. alexellisuk · · focus · HN ↗
          The world: &quot;build a secure, enterprise-ready microVM automation solution - work on it full time, and pay salaries for the staff that work on it&quot;

          Also: it has to be free.

          So yes you&#x27;re right, people confuse VC backed companies, and vibe-coded pet-projects for sustainable software.

          SlicerVM was started in 2022 and internal only, plenty of YouTube videos and such about it - written completely manually from our Actuated work.

          There&#x27;s a free trial for anyone who wants to play about on their Mac or Linux computer, the comment here is from a real user (unprompted) that knew and used free alternatives previously.

    2. innocent_name · · focus · HN ↗
      <a href="https:&#x2F;&#x2F;unikraft.com&#x2F;blog&#x2F;netlify-edge-functions" rel="nofollow">https:&#x2F;&#x2F;unikraft.com&#x2F;blog&#x2F;netlify-edge-functions and <a href="https:&#x2F;&#x2F;slicervm.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;slicervm.com&#x2F; both using the lookalike slop design template made me to believe it was a shadowy unikraft project lol.
    3. dwroberts · · focus · HN ↗
      &gt; I see firecracker replacing docker on the horizon

      I don’t think this is going to happen because they serve different purposes. Having to boot an entire OS inside a VM is a step backwards compared to containerisation. There are definitely use cases for isolating containers by running them inside a VM (see: Kata) but it generally ‘replacing’ docker, I don’t think that is on the horizon at all

      (Also: you need KVM available, you need a rootfs to boot which will be larger than a container, it has no built in support for mounts or really any kind of communication with the host unless you explicitly set up networking etc for it)

      1. jeroenhd · · focus · HN ↗
        &gt; Having to boot an entire OS inside a VM

        The whole point of Firecracker over normal VM solutions is that &quot;booting an OS&quot; takes milliseconds.

        Still, I don&#x27;t think Docker is at risk of being replaced just yet because of the resource management benefits you get from sharing a kernel.

        1. Normal_gaussian · · focus · HN ↗
          Balloon devices go a long way for ram sharing, though not all the way. CPU scheduling is great.

          There&#x27;s definitely a tradeoff, but IME it&#x27;s not as drastic as you first think.

        2. dwroberts · · focus · HN ↗
          Whether it takes milliseconds or seconds though, you are still doing it. You’re still just running a VM
        3. troupo · · focus · HN ↗
          &gt; The whole point of Firecracker over normal VM solutions is that &quot;booting an OS&quot; takes milliseconds.

          Define &quot;OS&quot;. A barebones OS will indeed start in microseconds. But then your app&#x2F;service won&#x27;t. Because it will likely need a gazillion things that a barebones OS doesn&#x27;t provide. Suddenly the startup time isn&#x27;t microseconds or even milliseconds.

          Sadly, we never got the promise of unikernels, and everything requires the full-blown OS to run anything

          1. jeroenhd · · focus · HN ↗
            The VM&#x27;s I&#x27;m talking about don&#x27;t run some kind of weird bespoke OS, just a normal Linux kernel. You can make Linux boot quite quickly if you strip out everything but the hardware you virtualise, and if you resume a snapshot from CoW RAM, you don&#x27;t even need to do that.

            I don&#x27;t have any recent measurements myself, but the startup time for a full Linux kernel using Firecracker&#x27;s snapshotting feature seems to be around 30ms if you optimise calls for latency: <a href="https:&#x2F;&#x2F;dev.to&#x2F;adwitiya&#x2F;how-i-built-sandboxes-that-boot-in-28ms-using-firecracker-snapshots-i0k" rel="nofollow">https:&#x2F;&#x2F;dev.to&#x2F;adwitiya&#x2F;how-i-built-sandboxes-that-boot-in-2...

            The measurements in that blog post place Firecracker above Docker in terms of startup performance. Most of that delay is probably the Docker daemon rather than Linux namespace APIs, but that&#x27;s beside the point.

            Huggingface places Firecracker startup time between 100-300ms while Docker is at 50-200ms, based on Kata: <a href="https:&#x2F;&#x2F;huggingface.co&#x2F;blog&#x2F;agentbox-master&#x2F;firecracker-vs-docker-tech-boundary" rel="nofollow">https:&#x2F;&#x2F;huggingface.co&#x2F;blog&#x2F;agentbox-master&#x2F;firecracker-vs-d...

            Either way, latency is in the same ballpark of &quot;low enough that it only matters in edge cases&quot;.

          2. pjmlp · · focus · HN ↗
            I would say that kind of got halfway there, when doing serverless.

            The gazillion things that the OS doesn&#x27;t provide is taken care by language runtimes, which can perfectly run directly on top of type 1 hypervisors.

            In similar way how some of those languages have bare metal implementations for embedded development, where the runtime takes the OS role.

            Naturally on languages with thin runtimes and heavy reliance on POSIX like C and C++, this isn&#x27;t as straightforward.

        4. chrisweekly · · focus · HN ↗
          Hmm... &quot;resource management benefits you get from sharing a kernel&quot; costs the security risks you incur from not having kernel-level isolation.

          These days I&#x27;m looking at microvms (esp. smolvm from smolmachines.com) by default, for anything where I&#x27;d previously have reached for docker (via colima or more recently orbstack).

      2. spwa4 · · focus · HN ↗
        &gt; Having to boot an entire OS inside a VM is a step backwards compared to containerisation

        If it boots faster than a container ...

        Also containers don&#x27;t work well with remote filesystems, or filesystems in general, because the admin always limits you.

    4. tietjens · · focus · HN ↗
      Would love to read a blog post about this if you&#x27;ve every time to cobble one together.
Open on Hacker News to reply ↗

Unofficial Hacker News client; not affiliated with Y Combinator.