From browser brat to backend boss: Will WASM win the web wars?
- Reference: 1693564507
- News link: https://www.theregister.co.uk/2023/09/01/wasm_column/
- Source link:
Recognizing the need for a more efficient way to run code in web browsers, the World Wide Web Consortium (W3C) and major browser vendors began working on a new binary format. This format aimed to be fast, efficient, and secure, allowing developers to run code at near-native speed. Thus, in 2015, [1]WASM was introduced as a low-level virtual machine that runs bytecode, which is translated from high-level languages.
Now, WASM is not a programming language per se. Instead it's a compact binary instruction format. Unlike JavaScript, which is interpreted, WASM is a low-level bytecode that runs in a sandboxed environment within the browser, ensuring both speed and security.
[2]
Developers love it because they can write code in languages they already know, such as C, C++, and Rust. Web developers were also pleased with it because they didn't need to replace their JavaScript programs. Instead they could [3]call WASM functions from JavaScript and vice versa , allowing for a seamless integration between the two.
[4]
[5]
At first, WASM was a pure web play. Then things changed. In 2019, Mozilla introduced its [6]WebAssembly System Interface (WASI) to access operating system resources. This [7]broke WebAssembly out of the browser .
Once out of the browser box, it became, as WASM expert and Fastly Director of Engineering Lin Clark put it, "a fast, scalable, secure way to run the same code across all machines."
[8]
Does that sound familiar? It should, you could use that same description for containers. But you don't need to believe me. As Solomon Hykes, Docker co-founder, [9]tweeted at the time: "If WASM+WASI existed in 2008, we wouldn't have needed to create Docker. That's how important it is. WebAssembly on the server is the future of computing. A standardized system interface was the missing link."
More recently, in 2023, the Cloud Native Computing Foundation's ( [10]CNCF ) head of ecosystem, Taylor Dolezal, said: "WebAssembly is the future because it is increasingly used for serverless, containerization and plug-in technologies and is expected to significantly impact web, serverless, gaming and containerization applications."
Strong words. So is WASM "the future of computing?"
[11]
Personally, I've been a cynic about it. While programs such as WASI and competing runtimes such as [12]WasmEdge have made it much easier to run WASM optimized code on the edge and the backend, it strikes me that there's still a lot of work to be done. And I'm not the only one who sees this problem.
As Torsten Volk, Enterprise Management Associates analyst, [13]has said : "There is a lot of ground to cover in terms of reliably and efficiently supporting production use cases." Exactly.
[14]A license to trust: Can you rely on 'open source' companies?
[15]Soon the most popular 'real' desktop will be the Linux desktop
[16]Meta can call Llama 2 open source as much as it likes, but that doesn't mean it is
[17]Red Hat's open source rot took root when IBM walked in
For example, Python has become the quick, easy way for people to work with machine learning programs – thank you, [18]PyTorch . But you can't simply drop these programs into WASM in a runtime and expect them to work. The problem is that you also need many third-party dependencies, which aren't there yet.
If WASM continues to rise in popularity, companies and open source groups will do the hard work of building these nuts and bolts.
But, wait, you say – isn't Kubernetes the future? Well, yes, but as Adobe pointed out recently, WASM and Kubernetes can work hand-in-hand. They worked out a way to make a " [19]full microservice , currently running in Kubernetes, and make it run in WASM."
Why? It gave them a more lightweight model that could be almost instantly scaled as traffic rose, giving more scheduling flexibility than a coarse-grained container, while still using Kubernetes to orchestrate everything. With this, Adobe could "securely enable high performance and efficiency, while still being compatible with Kubernetes." It was, for Adobe, the best of both worlds.
Adobe had more resources than most companies to throw at their problems. Looking ahead, though, WASM may become easier for smaller businesses to use on the backend.
That's because of the [20]WebAssembly Component Model (WACM) and [21]WASI-Preview 2 .
The former project will [22]incrementally define a component model . This will provide a portable, load and runtime-efficient binary format for separately compiled components built from WASM core modules that enable portable, cross-language composition. It will also provide better support for virtualizable, statically analyzable, capability-safe, language-agnostic interfaces.
The latter is the next version of [23]WASI . This will expand WASI's APIs beyond POSIX to WASI filesystem, HTTP, cloud, and network sockets. It will also provide better bindings for non-C-like languages.
Put it all together, and I think WASM may well finally live up to its potential. Still, there's many a slip between developers' ideas and production code. But the bricks to build practical WASI backend designs are now being fired. By 2025, we'll know if WASM will indeed prove to be the future of backend software development. ®
Get our [24]Tech Resources
[1] https://webassembly.org/
[2] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/devops&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=2&c=2ZPIKpbGGH111dap-7RB@@gAAA9I&t=ct%3Dns%26unitnum%3D2%26raptor%3Dcondor%26pos%3Dtop%26test%3D0
[3] https://hacks.mozilla.org/2017/02/creating-and-working-with-webassembly-modules/
[4] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/devops&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44ZPIKpbGGH111dap-7RB@@gAAA9I&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0
[5] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/devops&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33ZPIKpbGGH111dap-7RB@@gAAA9I&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0
[6] https://www.theregister.com/2019/03/29/mozilla_wasi_spec/
[7] https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/
[8] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/devops&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=4&c=44ZPIKpbGGH111dap-7RB@@gAAA9I&t=ct%3Dns%26unitnum%3D4%26raptor%3Dfalcon%26pos%3Dmid%26test%3D0
[9] https://twitter.com/solomonstre/status/1111004913222324225
[10] https://cncf.io/?utm_content=inline-mention
[11] https://pubads.g.doubleclick.net/gampad/jump?co=1&iu=/6978/reg_software/devops&sz=300x50%7C300x100%7C300x250%7C300x251%7C300x252%7C300x600%7C300x601&tile=3&c=33ZPIKpbGGH111dap-7RB@@gAAA9I&t=ct%3Dns%26unitnum%3D3%26raptor%3Deagle%26pos%3Dmid%26test%3D0
[12] https://wasmedge.org/
[13] https://thenewstack.io/is-webassembly-really-the-future/
[14] https://www.theregister.com/2023/08/18/opinion_column/
[15] https://www.theregister.com/2023/08/04/linux_desktop_cloud_desktops/
[16] https://www.theregister.com/2023/07/21/llama_is_not_open_source/
[17] https://www.theregister.com/2023/07/07/red_hat_open_source/
[18] https://pytorch.org/
[19] https://www.cncf.io/blog/2022/11/17/better-together-a-kubernetes-and-wasm-case-study/
[20] https://www.fermyon.com/blog/webassembly-component-model
[21] https://github.com/bytecodealliance/preview2-prototyping
[22] https://github.com/WebAssembly/component-model/blob/main/design/high-level/Goals.md
[23] https://wasi.dev/
[24] https://whitepapers.theregister.com/
It's called recycling.
There are no new ideas, just adaptations.
Re: Welcome back Java promise!!!
The big promise of Java was "write once, run anywhere" but it implied "compile once" because apparently compiling for different targets it just too hard dammit! But it isn't that hard really and fully compiled programs haven't gone away and Java was always a runner up to C++. WASM itself is pretty much a niche on the web since most apps don't need it and WASI will probably remain niche too.
Re: Welcome back Java promise!!!
As far as I know Java has delivered on those promises. People just aren't willing to adopt it because the UI looks "off."
And for web-based application there are more and better alternatives, such as C#, Rust and JavaScript.
Doesn't this sound like Java in the 90s?
A virtual machine running byte code that started out as an application platform for the browser? That would be Java in the 90s.
If you want to go back to the 70s, a virtual machine, running byte code, used as an application platform? That would be UCSD Pascal.
Or the 60s, it would be IBM CICS on DOS/VS or MVS. Hell, CICS can even serve web pages nowadays and IBM z/Series will still run code from the 60s.
Re: Doesn't this sound like Java in the 90s?
The most weird thing about WASM, at least to my mind, is that it would make considerably more sense to just simply come up with a standard bytecode for JavaScript.
I don't really like JavaScript, but given that's the way the DOM is accessed, it's something we're pretty much stuck with. WASM is extremely crude and calling between it and JavaScript (which is unavoidable if you want to do much with it) is incredibly hacky.
Doing any less just seems to create a pointlessly different environment just for the sake of it. Do any more and you are dangerously close to reinventing Java or .Net for no other reason than "but in a browser".
The essentially single-threaded nature of the UI (which is why the browser exists in the first place) and the ephemeral nature of mobile browser apps in any case puts practical limits on how you might use your chunk of bytecode: without defined methods of creating and communicating with background threads or processes and clear descriptions of how they survive (or don't) the closing of browser tabs, backgrounding of mobile apps, what context from the foreground they might reasonably access or inherit it's going to struggle ever to rise above novelty status.
Adobe did something securely?
As others have said, this is just Java bytecode / VM technology. (i.e Dis/Limbo, JVM/Java, .NET/C#)
However, where this might be different is that it represents a Java VM that other languages can be used and officially supported. C++ (Emscripten), Go and Rust are liked by many and having to use Java or Javascript would be dealbreakers for some.
In some ways, the popularity of .NET is also because different languages could be used, including C++/clr, IronPython, F# and.... er VB.NET
Off-topic, also just found these old articles, quite charming about the early COOL/C#:
https://www.theregister.com/1999/09/08/microsoft_set_to_unleash_javakiller/
and:
https://www.theregister.com/2000/09/12/official_microsofts_csharp_is_cool/
Surprised
I'm somewhat surprised that WASM hasn't already become the main compilation target on most operating systems. Its advantages are obvious and numerous and could substantially reduce software development costs.
Certainly it will take off in the cloud, allowing people to "bring their own binaries".
WASM is the new Flash. Or Active X. Take your pick.
Despite having had to work with it, I somehow expect it'll go the same way as both of those fairly soon.
Welcome back Java promise!!!
The EXACT same claims were made 30 years ago by Sun Microsystems. 20 years ago, Microsoft promised it with .NET. 10 years ago Node.js was making some familiar claims. And now.... WASM.... WASSSUP!!!!