Hi everyone,
I’m Jesús González, and I am part of VMware’s Wasm Labs: wasmlabs.dev<https://wasmlabs.dev/>, a group focused on creating open source tools for WebAssembly.
We have created mod_wasm, an Apache module for running WebAssembly binaries inside httpd, and we would like to contribute it upstream. Please see below for more details. We would love to get your feedback and understand what improvements would be needed (if any) before it could be considered for contribution to the project.
The details:
WebAssembly<https://webassembly.org/> (Wasm) is a new binary instruction format that is open, portable, efficient, secure, and polyglot. It originated in the browser but is increasingly used in server applications, in particular NGINX, Apache APISIX, Istio provide Wasm-based plugin support (i.e.: https://apisix.apache.org/docs/apisix/wasm/).
mod_wasm is a way to run WebAssembly modules inside Apache Server. This is similar to how mod_php embeds a PHP runtime to run PHP code. This enables any language that supports WebAssembly (including C++, Rust, Go but also Python, PHP, Ruby) to run with mod_wasm and take advantage of the extra level of security and sandboxing. To learn more about mod_wasm you can check out the following resources:
* An overview article<https://wasmlabs.dev/articles/apache-mod-wasm/> for the original release.
* We presented mod_wasm at ApacheCon this year and here are the slides<https://apachecon.com/acna2022/slides/01_Gonz%c3%a1lez_mod-wasm_Bringing_WebAssembly.pdf> and the source code: https://github.com/vmware-labs/mod_wasm.
* CNCF Talk on mod_wasm showcasing how to run WordPress: https://www.youtube.com/watch?v=jXe8kulUscQ
In terms of mod_wasm architecture, the module is split into two parts:
* mod_wasm.so is the extension module for Apache and it’s written in C.
* An external dependency: libwasm_runtime.so, which is written in Rust and needs to be installed into the system.
We modelled this after mod_tls, a module that is part of httpd and also has a Rust dependency.
You can take a look at the architecture diagram and instructions on how to build the module here: https://github.com/vmware-labs/mod_wasm#%EF%B8%8F-building-mod_wasm
In terms of the actual contribution, please find a patch attached. We tried to follow all existing conventions in terms of autoconf/automake, providing module documentation, etc. Please let us know anything that you see missing or could be improved. In particular, we do not know yet if it is better to keep the Rust code separate, as an external dependency (like mod_tls does) or in the Apache source code repository.
In summary, we believe mod_wasm is a worthy addition to httpd and it will allow us to catch up to some of the other web servers already supporting Wasm, like NGINX. We were encouraged by Rich Bowen, Jim Jagielski and Jean-Frederic Clere to submit it for contribution upstream and we are looking forward to your feedback.
Cheers!
Jesús
I’m Jesús González, and I am part of VMware’s Wasm Labs: wasmlabs.dev<https://wasmlabs.dev/>, a group focused on creating open source tools for WebAssembly.
We have created mod_wasm, an Apache module for running WebAssembly binaries inside httpd, and we would like to contribute it upstream. Please see below for more details. We would love to get your feedback and understand what improvements would be needed (if any) before it could be considered for contribution to the project.
The details:
WebAssembly<https://webassembly.org/> (Wasm) is a new binary instruction format that is open, portable, efficient, secure, and polyglot. It originated in the browser but is increasingly used in server applications, in particular NGINX, Apache APISIX, Istio provide Wasm-based plugin support (i.e.: https://apisix.apache.org/docs/apisix/wasm/).
mod_wasm is a way to run WebAssembly modules inside Apache Server. This is similar to how mod_php embeds a PHP runtime to run PHP code. This enables any language that supports WebAssembly (including C++, Rust, Go but also Python, PHP, Ruby) to run with mod_wasm and take advantage of the extra level of security and sandboxing. To learn more about mod_wasm you can check out the following resources:
* An overview article<https://wasmlabs.dev/articles/apache-mod-wasm/> for the original release.
* We presented mod_wasm at ApacheCon this year and here are the slides<https://apachecon.com/acna2022/slides/01_Gonz%c3%a1lez_mod-wasm_Bringing_WebAssembly.pdf> and the source code: https://github.com/vmware-labs/mod_wasm.
* CNCF Talk on mod_wasm showcasing how to run WordPress: https://www.youtube.com/watch?v=jXe8kulUscQ
In terms of mod_wasm architecture, the module is split into two parts:
* mod_wasm.so is the extension module for Apache and it’s written in C.
* An external dependency: libwasm_runtime.so, which is written in Rust and needs to be installed into the system.
We modelled this after mod_tls, a module that is part of httpd and also has a Rust dependency.
You can take a look at the architecture diagram and instructions on how to build the module here: https://github.com/vmware-labs/mod_wasm#%EF%B8%8F-building-mod_wasm
In terms of the actual contribution, please find a patch attached. We tried to follow all existing conventions in terms of autoconf/automake, providing module documentation, etc. Please let us know anything that you see missing or could be improved. In particular, we do not know yet if it is better to keep the Rust code separate, as an external dependency (like mod_tls does) or in the Apache source code repository.
In summary, we believe mod_wasm is a worthy addition to httpd and it will allow us to catch up to some of the other web servers already supporting Wasm, like NGINX. We were encouraged by Rich Bowen, Jim Jagielski and Jean-Frederic Clere to submit it for contribution upstream and we are looking forward to your feedback.
Cheers!
Jesús