The Tug-of-War over Server-Side WebAssembly

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • SonarLint - Clean code begins in your IDE with SonarLint
  • InfluxDB - Access the most powerful time series database as a service
  • SaaSHub - Software Alternatives and Reviews
  • rust

    Empowering everyone to build reliable and efficient software.

    Further down that GitHub issue, it mentions the problem has been fixed:

    * https://github.com/rust-lang/rust/issues/71871#issuecomment-...

    * https://github.com/rust-lang/rust/pull/79998

    Weirdly though, there's another issue (opened prior) that's ongoing and seems to indicate things aren't fixed after all:

    * https://github.com/rustwasm/team/issues/291

  • browser_wasi_shim

    A WASI shim for in the browser

    Indeed, some people are doing this:

    - WASI once had an official polyfill https://wasi.dev/polyfill/, now apparently succeeded by https://github.com/bjorn3/browser_wasi_shim

    - wasmer-js provides a JS polyfill for WASI https://docs.wasmer.io/integrations/js/wasi

    - Cloudflare has a WIP polyfill https://github.com/cloudflare/workers-wasi

    I'm generally leery of non-temporary polyfills, so I'm not sure that any of these feel like a long-term viable option for me.

  • SonarLint

    Clean code begins in your IDE with SonarLint. Up your coding game and discover issues early. SonarLint is a free plugin that helps you find & fix bugs and security issues from the moment you start writing code. Install from your favorite IDE marketplace today.

  • workers-wasi

    Indeed, some people are doing this:

    - WASI once had an official polyfill https://wasi.dev/polyfill/, now apparently succeeded by https://github.com/bjorn3/browser_wasi_shim

    - wasmer-js provides a JS polyfill for WASI https://docs.wasmer.io/integrations/js/wasi

    - Cloudflare has a WIP polyfill https://github.com/cloudflare/workers-wasi

    I'm generally leery of non-temporary polyfills, so I'm not sure that any of these feel like a long-term viable option for me.

  • noah

    Bash on Ubuntu on macOS

    The other day I came across an interesting "alternative" to WASM which gives you OS portability using fully native code, without CPU portability, the latter seeming not that big of a deal these days anyway as cross compilers have got quite good and there are only two CPU archs in wide usage anyway.

    The idea is to simply run normal Linux binaries on macOS and Windows. How? You create a virtual machine using the Mac/Windows APIs without any OS inside, in fact without even any virtual hardware. It's literally just a new address space and some trivial min-viable VM configuration. Then you map the ELF binary and a ld.so into the VM with a minimal ELF interpreter, kick off execution and anytime there's a syscall you trap it and translate to the host OS syscalls. It can work quite well on macOS because the syscall interface is so similar.

    Note that this sort of VM is not:

    • A sandbox

    • A hardware abstraction

    Apps run this way hold all their data in the filing system of the host OS, they use the network stack of the host OS, etc. The VM is only being used to allow trapping and emulation of the syscall interface. The app isn't aware that it's being run in a special CPU mode on top of an emulated kernel.

    Advantages: lightweight, simple, apps can use all CPU features, can run at native speed, the Linux syscall interface is highly stable, based on POSIX specifications and you can easily pick a subset of it to standardize.

    Disadvantages: requires the emulator, apps exposed to missing features or quirks of the host OS e.g. Windows file system performance is much lower than Linux.

    WSL1 sort of worked that way, albeit without the VM aspect that lets userspace apps do it. They abandoned it partly for performance reasons and users expected all existing Linux apps to just work. But WASM doesn't target existing apps. It expects developers to bend and do things the WASM way, and accepts that not all apps are compatible with it, so that's not necessarily a problem.

    An example of how to implement this is NOAH:

    https://github.com/linux-noah/noah/

  • memory-control

    A proposal to introduce finer grained control of WebAssembly memory.

    Additionally, googlers are championing memory control https://github.com/WebAssembly/memory-control/blob/main/prop..., which provides memory protection.

  • WASI

    WebAssembly System Interface

    I've been reading the following repositories.

    https://github.com/WebAssembly/WASI/blob/main/Proposals.md

  • wasi-threads

  • InfluxDB

    Access the most powerful time series database as a service. Ingest, store, & analyze all types of time series data in a fully-managed, purpose-built database. Keep data forever with low-cost storage and superior data compression.

  • cloudlibc

    CloudABI's standard C library

    Deep respect to the CloudABI folks, a project inspired the WASI ideas:

    > CloudABI is no longer being maintained. It was an awesome experiment, but it never got enough traction to be sustainable. If you like the idea behind CloudABI, please consider looking into the WebAssembly System Interface (WASI). WASI's design has been inspired by CloudABI.

    https://github.com/NuxiNL/cloudlibc

  • design

    WebAssembly Design Documents

    Giving you a buffer that grows is the allocation approach I am talking about. This is not how your OS works. Your OS itself works with an allocator that does a pretty good job making sure that your memory ends up not fragmented. Because WASM is in between, the OS is not in control of the memory, and instead the browser is. The browser implementation of "bring your own allocator" is cute but realistically just a waste of time for everybody who wants to deploy a wasm app because whatever allocator you bring is crippled by the overarching allocator of the browser messing everything up.

    It seems like the vendors are recognizing this though, with firefox now having a discard function aparently!

    https://github.com/WebAssembly/design/issues/1397

  • team

    A point of coordination for all things Rust and WebAssembly

    Further down that GitHub issue, it mentions the problem has been fixed:

    * https://github.com/rust-lang/rust/issues/71871#issuecomment-...

    * https://github.com/rust-lang/rust/pull/79998

    Weirdly though, there's another issue (opened prior) that's ongoing and seems to indicate things aren't fixed after all:

    * https://github.com/rustwasm/team/issues/291

  • hangover

    Hangover runs simple (Win64/)Win32 applications on arm64/(ppc64le)/x86_64 Linux and x86_64 Mac

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts