Cool stuff! On Mon, Nov 28, 2022 at 1:18 PM Jesús González <jesu...@vmware.com> wrote:
> Hi everyone, > > > > Following up on our email about contributing mod_wasm, we have continued > to make progress on our side and just released mod_wasm v0.10.0. > > > > In this version, among other improvements, we introduce two major features: > > - #1: Wasm multi-module support > - #2: Shared Wasm modules > > > > In #1, you can now specify different Wasm modules to be used in different > routes. For instance, now it’s possible with one-single Apache instance to > load simultaneously the Wasm builds for the PHP > <https://github.com/vmware-labs/webassembly-language-runtimes/releases> > and Python <https://github.com/tiran/cpython-wasm-test/releases> > interpreters (and any other languages that compile to Wasm now or in the > future). > > > > And in #2, you can now specify different per-route configurations to the > same Wasm module. The Wasm binary is loaded in memory only once, and the > different configurations are applied to the Wasm module per-HTTP request. > > > > Combining all together, you can have a more flexible configuration such > as: > > > > <Location /wordpress> > > SetHandler wasm-handler > > WasmModule /var/www/modules/php7.4.32.wasm > > WasmDir /tmp > > … > > </Location> > > > > <Location /python-app> > > SetHandler wasm-handler > > WasmModule /var/www/modules/python3.11.wasm > > WasmArg /var/www/python-app/app.py > > … > > </Location> > > > > <Location /python-app2> > > SetHandler wasm-handler > > WasmModule /var/www/modules/python3.11.wasm > > WasmArg /var/www/python-app2/app2.py > > … > > </Location> > > > > > > We have run some simple, preliminary stress tests using ApacheBench and > mod_wasm performs great in both MPM event and MPM worker modes. > > > > Hope you can find some time to try mod_wasm and provide feedback. Let us > know if you have questions or suggestions. > > Jesús > > > > PS: Updated patch attached. > > > > > > *De: *Jesús González <jesu...@vmware.com> > *Responder a: *"dev@httpd.apache.org" <dev@httpd.apache.org> > *Fecha: *lunes, 14 de noviembre de 2022, 7:38 > *Para: *"dev@httpd.apache.org" <dev@httpd.apache.org> > *CC: *Daniel Lopez Ridruejo <daniello...@vmware.com> > *Asunto: *mod_wasm: Contributing Upstream to Apache > > > > Hi everyone, > > > > I’m Jesús González, and I am part of VMware’s Wasm Labs: wasmlabs.dev > <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwasmlabs.dev%2F&data=05%7C01%7Cjesusgm%40vmware.com%7C07586834510d4ffc0a5108dac60ac618%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638040046834229085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=hQnzxjyjL4RPU5GK%2FUz9N6AMlsTsJlxX%2BQSkn2E8XzI%3D&reserved=0>, > 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://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwebassembly.org%2F&data=05%7C01%7Cjesusgm%40vmware.com%7C07586834510d4ffc0a5108dac60ac618%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638040046834229085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MsBjIpsju0J9AHkCXLy2%2BY83MIaLzhywcjIIPOAcKkg%3D&reserved=0> > (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/ > <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapisix.apache.org%2Fdocs%2Fapisix%2Fwasm%2F&data=05%7C01%7Cjesusgm%40vmware.com%7C07586834510d4ffc0a5108dac60ac618%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638040046834229085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=jXuPc0uRObYzq6O98T51ypWizrmus%2FdSGwGk6Gi40VQ%3D&reserved=0> > ). > > > > 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://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwasmlabs.dev%2Farticles%2Fapache-mod-wasm%2F&data=05%7C01%7Cjesusgm%40vmware.com%7C07586834510d4ffc0a5108dac60ac618%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638040046834229085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=d2MpWnkiKJA4fDOUdNghYPg0p4fMsGTeGiFR6kfcwyg%3D&reserved=0> > for the original release. > - We presented mod_wasm at ApacheCon this year and here are the slides > > <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapachecon.com%2Facna2022%2Fslides%2F01_Gonz%25C3%25A1lez_mod-wasm_Bringing_WebAssembly.pdf&data=05%7C01%7Cjesusgm%40vmware.com%7C07586834510d4ffc0a5108dac60ac618%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638040046834229085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=c9U4xL6091Lei7hPlQ83PP6naUCI0SMIxmW0qvRJCq4%3D&reserved=0> > and the source code: https://github.com/vmware-labs/mod_wasm > > <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvmware-labs%2Fmod_wasm&data=05%7C01%7Cjesusgm%40vmware.com%7C07586834510d4ffc0a5108dac60ac618%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638040046834229085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=5oF9oB7rTpJZfUyECkvOfSnEkdaRT1UhIgOIVBD%2F9fs%3D&reserved=0> > . > - CNCF Talk on mod_wasm showcasing how to run WordPress: > https://www.youtube.com/watch?v=jXe8kulUscQ > > <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DjXe8kulUscQ&data=05%7C01%7Cjesusgm%40vmware.com%7C07586834510d4ffc0a5108dac60ac618%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638040046834229085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=GTh0dro4fqACMKnluAvXITVQFNOUL1BEiijKuSgdVkA%3D&reserved=0> > > > > 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 > <https://nam04.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fvmware-labs%2Fmod_wasm%23%25EF%25B8%258F-building-mod_wasm&data=05%7C01%7Cjesusgm%40vmware.com%7C07586834510d4ffc0a5108dac60ac618%7Cb39138ca3cee4b4aa4d6cd83d9dd62f0%7C0%7C0%7C638040046834229085%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=riwxB9vHMxT%2ByvYzGUXBXtgqMi%2B9%2BRVb1zUZSaTxTHE%3D&reserved=0> > > > > 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 > > > > > -- Joe Schaefer, Ph.D. We only build what you need built. <j...@sunstarsys.com> 954.253.3732 <//954.253.3732>