Hacker News new | past | comments | ask | show | jobs | submit login

It takes tens or hundreds of microseconds to launch a new thread on Linux, and tens or hundreds of milliseconds (or more) to launch a new VM.

It takes tens of cycles to instantiate a Wasm module and call one of its exported functions.

There are some serious benefits to OS-mediated hardware isolation, but there are also some real benefits to the "ahead-of-time" isolation you can get from something like Wasm (e.g. via wasm2c->a C compiler->machine code, but also with more mainstream tools like wasmtime).




That's an impressive feat if true, but I wonder when you would need it outside of a seriously threaded architecture. That is, the server you are embedded in has one thread per client or backend. In a modern server architecture I suspect you could still use KVM if you put your mind to it. For example, switching between internal processes doesn't have to be done according to Linux scheduling. KVM is just a hypervisor architecture, and even though it requires you to call it from the current thread, you can still build fast process isolation on it. Source: I have done it.

Launching a new VM is not something that should be done outside of a restart or reconfiguration.

I think for me, what WASM brings to the table is perhaps reduced Linux-isms. Everything has become a little bit Linux-or-nothing, and if WASM presents a unified API towards all operating systems that is a good thing. I'm still not happy that Browsers are de-facto operating systems now, and with WASM even more so.


I gave a talk at Cloud Native wasm day talking about some of the stuff you can do with a WasmVM. Redpanda (where I work) is a storage engine who’s performance is predicated on kernel bypass (Direct IO, thread per core, locked memory). You can use stack switching to context switch between the VM and host application in a handful of cycles. Also having good upstream tooling for a lot of popular languages is big for adoption.

Link to the talk if interested: https://youtu.be/t4-Al2FoU0k


Cool. I watched it twice! I thought you meant the stack switching done by wasmtime, which is not "a handful of cycles," but I stand corrected: It's fiber/coro switching. Alfred, a friend of mine, gave a talk on using those on a bare metal unikernel we were creating back in the day! :)


Yeah it’s just the stack switching itself that is a handful of cycles, but there is not much more overhead for the full VM switch if you structure your embedding the right way. Code the code is source available if you want to peek at it!

https://github.com/redpanda-data/redpanda/blob/dev/src/v/was...




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: