[HN Gopher] mod_wasm: Run WebAssembly with Apache
___________________________________________________________________
mod_wasm: Run WebAssembly with Apache
Author : ereslibre
Score : 87 points
Date : 2022-10-03 15:34 UTC (7 hours ago)
(HTM) web link (wasmlabs.dev)
(TXT) w3m dump (wasmlabs.dev)
| api wrote:
| WASM is still too unapproachable. I've looked into how to build
| things for WASI/WASM and it seems like you're just dropped into
| this world of tooling and development practices that I'm sure
| makes tons of sense to people who are already steeped in the WASM
| ecosystem but is disorienting for someone new.
|
| WASM really needs some getting started guides that describe what
| the hell is going on and what the capabilities and limitations
| are and how to... well... get started.
| angelmm wrote:
| Hey, dev here :)
|
| Totally agree with you. WebAssembly has a lot of potential, but
| currently the entry barries is quite high and for some use
| cases, it's not mature enough. As you mention, tooling is
| unclear, and the ecosystem misses important features such as
| debugging capabilities.
|
| However, at the same it's an exciting ecosystem for the same
| reason: there's a lot to explore and improve. Hopefully, these
| projects we are building gathers the interest from different
| communities and more people start adding ideas.
|
| And for future ideas, what would you like to be covered in an
| article about WebAssembly? Thanks!
| d883kd8 wrote:
| Does this mean I could write a web api in Rust and deploy it to
| e.g. Hostgator or Bluehost?
| yjftsjthsd-h wrote:
| It would still require the host to have the module installed,
| right? That might come to be common, but it is a requirement
| that I don't expect everyone to decide to implement
| politelemon wrote:
| I struggle to understand wasm, though I'm interested. What does
| this part mean?
|
| > Internally, it uses the wasmtime runtime to configure,
| initialize, and run the Wasm modules.
|
| What is wasmtime? I looked at its page and couldn't figure out
| what they mean by a wasm runtime. I thought the runtime was in
| the browser. Wouldn't a user just need to compile and just a
| binary?
| encryptluks2 wrote:
| It appears to be a language that you compile another language
| into so that you can get more inception-like while sacrificing
| performance optimizations of using a native language.
| pdpi wrote:
| Easiest comparison is the JVM. You can run Java wherever you
| have a JVM, be it the browser or the server or a desktop
| application. WASM is basically the moral equivalent of JVM
| bytecode, so you need the moral equivalent of the JVM to run
| it.
|
| While all major browsers have wasm support (the wasm "JVM") as
| part of their javascript stack, there's also standalone wasm
| runtimes, with wasmtime being one of those.
| callahad wrote:
| > _I thought the runtime was in the browser._
|
| It can be both! Like JavaScript, WebAssembly started in the
| browser but is now moving to the server-side, too. With
| JavaScript, the most common serverside runtime is Node.js. With
| WebAssembly, it's Wasmtime. There are alternatives (like Deno
| or Bun for serverside JavaScript), but Wasmtime is the main one
| at the moment.
| politelemon wrote:
| Thanks the NodeJS analogy helps me.
| lbhdc wrote:
| It is a runtime for wasm. Wasm is not executable in the same
| way an x86 binary is. It needs to run in a vm. Wasmtime is one
| such vm. In a browser context that vm is v8.
|
| https://github.com/bytecodealliance/wasmtime
| egberts1 wrote:
| Or for Firefox, SpiderMonkey JIT.
|
| V8 is a chrome-specific thingie.
| baby wrote:
| I always found it uber cumbersome to deal with apache to setup
| different webservers with different domains and different stacks
| (php, golang, node, etc.) on a linux server.
|
| I've been doing it for more than 10 years and I still hate it and
| I'm still quite lost in the commands I need to run, the folders
| and files and cfgs I need to maintain.
|
| Am I just a linux noob and this is completely normal user
| experience?
| orev wrote:
| The biggest problem with Apache httpd is how many awful
| copy/paste blogs there are out there telling you how to do
| things on Ubuntu, which has no resemblance at all to actually
| managing httpd. Everything explains how to use some silly
| wrapper script like a2enmod to do something when all you really
| need is to make a symlink or something like that. IMO, the
| Ubuntu method of managing httpd could easily be responsible for
| why so many people think nginx is easier.
|
| Use a RHEL based system and manually edit the files yourself.
| It's very easy.
| BeefWellington wrote:
| Apache itself is eminently manageable on its own; IMO the real
| issue is how insanely over-complicated and opinionated every
| distribution makes their configuration.
|
| I tend to discard any given distribution's default
| configuration for a more simplistic one where httpd.conf is the
| source of truth. This is very simple for 90% of my use cases,
| and for the other 10% I can adopt of a "modules-enabled, sites-
| enabled, conf-enabled, kitchen-sink-enabled" type approach.
| NoGravitas wrote:
| sdze wrote:
| Is that the same shared nothing architecture just like when I am
| invoking a php script via cgi call or mod-php?
| MR4D wrote:
| So, is this like mod_CGI, but more modern technology?
| encryptluks2 wrote:
| WASM isn't more more "modern", it is just being hyped up
| because it caters to the JS developers.
| MobiusHorizons wrote:
| What is the actual problem this is trying to solve? Are there
| programming languages it was previously hard to write web apps
| in? Do people not like setting up nginx?
|
| From my understanding the benefit of wasm on the server side is
| generally that you get the sandboxing inherent in the VM. Why
| would you want that in the context of Apache? Are people planning
| on running untrusted code?
|
| If mod_wasm is designed to address any of those issues (which are
| touched on only briefly in the article), it would be nice for it
| to describe how using wasm improves over other techniques one
| might use to solve those problems like using containers or VMs
| for encapsulating the execution environment.
| colordrops wrote:
| One of the reasons PHP gained so much traction was because it
| is very easy to deploy and run, no dependency hell. WASM is
| self-contained and has the same property.
| egberts1 wrote:
| Now it is the battle of keeping the zillions of JavaScript
| packages vs PHP packages up ... to ... date.
|
| I think WASM may have bigger problems with external
| vulnerability assessment team identifying those modules by
| version that got broken.
| _joel wrote:
| I don't think they're different issues in terms of
| solution, important, of course.
| angelmm wrote:
| Running WebAssembly modules in Apache http server allows devs
| to run many different languages by targetting Wasm. This
| includes interpreted languages like the Python example from the
| article.
|
| With the WebAssembly sandboxing capabilities you're getting a
| high level of isolation without adding overhead to the system.
| VMs and Containers require to run more complex environment for
| runnning the code. And even you're running trusted code,
| sandboxing is still relevant as vulnerabilities in source code
| can let attackers gain unexpected privileges.
|
| mod_wasm was created to bring these benefits to Apache. We
| found this project interesting as this expands the Apache
| capabilities while keeping things secure :)
| moralestapia wrote:
| Two types of developers I guess. -\\_(tsu)_/-
|
| I think this has a bright future ahead:
|
| * wasm has a lot of traction, just yesterday I wrote a first
| test on deploying wasm to cloudflare workers (the latency when
| the deployed function was really low)
|
| * apache httpd is still one of the most used http servers in
| the wild
|
| So, I think it's just a natural fit.
|
| wasm will be huge, btw, if you haven't noticed that you haven't
| been paying attention.
| znpy wrote:
| > Do people not like setting up nginx?
|
| I don't.
|
| But I'm just cranky... apache httpd works well for me and I
| don't feel the need for nginx.
| gzurl wrote:
| Think in the minimum container you need to run some Python code
| (>300MB?). Now, compare that to just the Python interpreter
| compiled into Wasm (25MB). If you need deploy that into
| different nodes, that's a huge difference.
|
| Also, Wasm modules don't have cold-starts as containers.
|
| Regarding running untrusted code, ask the folks at AWS, Azure
| or Google Cloud dealing with that...
| ereslibre wrote:
| Apache httpd is a modular web server that powers 31% of all
| websites you access every day. One of its most compelling
| features is the ability to extend it with new modules. Developers
| can choose among different modules to add or remove features like
| CGI, TLS, PHP, and many others.
|
| Today, we announce a new Apache module to run WebAssembly
| modules: mod_wasm. This module opens a new set of possibilities
| as many languages and projects can run securely in Apache.
| ofrzeta wrote:
| so .. OCTO is the Office of the CTO at VMware.
| skibz wrote:
| Does nginx have any (third-party?) modules that are roughly
| equivalent to this?
| joecot wrote:
| wasm-nginx-module
|
| https://wasmedge.org/book/en/use_cases/frameworks/mesh/wasm-...
| VWWHFSfQ wrote:
| So it requires the nginx Lua module which is then used to
| load the wasm blobs? what a weird module. So somehow this
| thing is going through at least 2 or 3 different VMs (LuaJIT
| + WASI) so that you can eventually run your Python script in
| nginx...
| gzurl wrote:
| https://github.com/vmware-labs/mod_wasm
___________________________________________________________________
(page generated 2022-10-03 23:01 UTC)