45

Nginx on Wasmjit

 5 years ago
source link: https://www.tuicool.com/articles/hit/jymQbaY
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

As of a few days ago, Wasmjit is able to run Nginx 1.15.3 in user space. This means you can use Wasmjit to run the same nginx.wasm on all POSIX systems. So far it’s been tested on Linux, OpenBSD, and macOS. It’s not a stripped down version of Nginx: it’s the whole thing, compiled straight from source without modification and with multi-process capability. All the complex bits of the POSIX API required for Nginx have been implemented, including signal handling and forking.

Kernel space support still requires more work. Emscripten delegates certain large APIs like getaddrinfo() and strftime() to the host implementation, and these would require re-implementation in the kernel. In addition, implementing kernel space versions of fork() , execve() , and signal handling still needs to be done. We will publish performance benchmarks when this work is completed.

Since its inception in late July, getting Nginx to run on Wasmjit has been a primary goal. While it might be convenient to run the same binary on multiple systems without modification (“write once, run anywhere”), this goal was chosen because IO-bound / system call heavy servers stand to gain the most by running in kernel space. Running FUSE file systems in kernel space is another motivating use case that Wasmjit will soon support.

Wasmjit is still alpha-level software in development. Don’t use it in production unless you’re willing to deal with unpredictable circumstances. If you want it to become production-ready software, don’t hesitate to get in touch.


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK