1000 req/s != 1ms response time. Even if you run it all on a single core. Getting actual sub-millisecond response times is fairly hard for anything involving state.
I’d never heard of lunatic before - green threads as a feature of the WASM runtime is a really neat feature I hadn’t thought of before! I’m excited to see that ecosystem develop.
Forgive me if I missed it. What is Web Assembly doing here? It sounds like the runtime uses the web assembly output? What is the benefit of this instead of running the rust code for whatever hardware your server is running?
Interesting project either way! The api seems nice at first glance.
I see security listed as a web assembly benefit, but that is for running untrusted code right? I imagine your web server code is trusted.
If you have any articles about that, please post them. I read the lunatic readme and it’s a little light on details. It mostly just described how it inherits the benefits of webassembly.
It definitely leverages a lot of WebAssembly’s features (e.g. very lightweight sandboxing, support for various languages, etc). The wasmtime documentation (the WebAssembly JIT which Lunatic uses) has a lot of information about how it executes WebAssembly, as well as the API it provides to manipulate WebAssembly programs and interface with them while running them.
In terms of concrete things Lunatic does (as I understand it)
all IO operations are processed asynchronously øn the Rust side (so other processes can continue to run even while one process is waiting on the result of a blocking IO operation)
every process is only permitted to run for a certain number of instructions before it is paused so that a different process can run
By the time you’re selecting which interpreter to suspend and resume, you’ve reinvented a thread scheduler. However, your thread scheduler has a VM save/restore in the loop. You’d need to measure, but it may not be faster than just using a thread.
“submillisecond” is just a brand name, they make no actual substantial claims about performance at all in the document. oh well.
Excellent marketing, because getting 1000 req/s is easy.
1000 req/s != 1ms response time. Even if you run it all on a single core. Getting actual sub-millisecond response times is fairly hard for anything involving state.
Ah, extrapolating latency from throughput. The classic.
I’d never heard of lunatic before - green threads as a feature of the WASM runtime is a really neat feature I hadn’t thought of before! I’m excited to see that ecosystem develop.
Forgive me if I missed it. What is Web Assembly doing here? It sounds like the runtime uses the web assembly output? What is the benefit of this instead of running the rust code for whatever hardware your server is running?
Interesting project either way! The api seems nice at first glance.
I see security listed as a web assembly benefit, but that is for running untrusted code right? I imagine your web server code is trusted.
It replaces async/await. A WASM interpreter is able to suspend WASM code at any time, without involving OS threads or explicit futures.
If you have any articles about that, please post them. I read the lunatic readme and it’s a little light on details. It mostly just described how it inherits the benefits of webassembly.
It definitely leverages a lot of WebAssembly’s features (e.g. very lightweight sandboxing, support for various languages, etc). The wasmtime documentation (the WebAssembly JIT which Lunatic uses) has a lot of information about how it executes WebAssembly, as well as the API it provides to manipulate WebAssembly programs and interface with them while running them.
In terms of concrete things Lunatic does (as I understand it)
By the time you’re selecting which interpreter to suspend and resume, you’ve reinvented a thread scheduler. However, your thread scheduler has a VM save/restore in the loop. You’d need to measure, but it may not be faster than just using a thread.
The wasm is because this is built on lunatic, which is a wasm runtime
Oh, the easy part is just todo.