Golem Cloud is a serverless cloud computing platform that hosts only applications that are compiled to WebAssembly, or which can be interpreted by an interpreter that is itself compiled to WebAssembly.
This is a stark difference to most cloud computing platforms, such as AWS, which let you deploy native code applications, JVM applications, and CLR applications, so long as you have the appropriate software.
What's the deal with WebAssembly, and why did Golem Cloud choose to support this technology, rather than taking a more traditional approach?
In this post, I will introduce WebAssembly for those who are new to the space, discuss why it matters, and talk about the reason Golem Cloud is supporting this technology.
WebAssembly, or WASM, for short, was the successor to asm.js, a specification that was designed to allow compiled languages like C to target the browser (why should Javasccript have all the fun?).
Making its debut in March 2017, WebAssembly enjoyed broad browser support, and as of today, 96% of all installed browsers support WASM. For the latest browser versions, this figure reaches 100%.
Although the specification was born in the browser, WebAssembly is not really a browser technology. It's much deeper than that.
WebAssembly is a formal specification for portable machine code, similar the Java Virtual Machine or CLR. Unlike x86 or ARM machine code, WASM is cannot be executed directly by existing CPUs.
To be executed, a WASM program is either compiled into a platform (for example, Windows running on x86), or interpreted by another program that can run on such a platform.
The software that enables WebAssembly programs to actually be executed on a platform is referred to as a WebAssembly runtime.
These days, however, WASM runtimes go way beyond browsers.
An increasing number of cloud providers, including Cloudflare, Fastly, Fermyon, and many others, now offer server-side WASM.
How did a technology intended to bring server-side languages like C to the browser end up back on the server-side??
There are a few key innovations driving this shift:
WASM gives us more than just a portable code format: it gives us a way to distribute high-performance, low-latency, secure, sandboxed code that can run on any machine, regardless of architecture, without the need for containerization or OS virtualization.
It's almost like a "virtual machine" designed for the cloud era: it has all the properties we want as a general-purpose format for transporting and deploying our programs into the cloud.
More interesting still, due to the unique design of WASM, in which a program can only access capabilities providing by its host, WASM is opening up new frontiers in cloud computing.
WASM is a gift to creators of cloud tooling. Not only can tooling inspect the structure of WASM programs and modify them, but more importantly, WASM programs interact with the outside world only through capabilities provided by their host environment.
By way of example, if you call
System.currentTimeMillis() in your Java program, which is then compiled to WASM, then this ultimately gets translated into a call to a low-level WASI function that the WASM runtime provides to your WASM program.
Because the host provides all such functions, it means if you want to create powerful WASM tooling, you can do so by making your own host, and implementing your own low-level WASI functions, or by wrapping standard implementations, adding or modifying the behavior of any WASM programs that are executed by your host.
This allows some pretty interesting features, such as the following:
In essence, WASM makes it so that the ordinary-looking program that you write in whatever programming language you want (so long as it targets WASM) can behave in very special ways thanks to the unique constraints on WASM programs.
This is why Golem Cloud supports WASM.
Golem Cloud is powered by a customized WASM runtime, which provides a custom host environment, with highly specialized implementations of all WASI functions that (ultimately) let your program interact with the outside world.
This lets Golem Cloud see all the interactions that your program makes with the outside world. Obsersving these interactions, together with having direct access to the memory of your program, allow Golem Cloud to continously save tiny incremental changes as your program executes, ensuring that in the event of failure, your worker can resume exactly where it left off.
WASM gives Golem Cloud the capability to make programs in any programming language invincible--a feat that would be completely impossible with machine code, due to its highly unconstrained nature.
These benefits provide a compelling package for modern cloud developers, although the WASM communtiy as a whole still has more work to do to reap the full benefits of this technology.
The main drawback that WASM has right now is simply that it is an early-stage technology, without rich tooling and language support. Because of its infancy, not all programming languages target WASM.
Indeed, the low-level WASI interfaces needed to have programs compile to portable, standards-compliant WASM are not yet finalized, which means that supporting WASM is a bit of a moving target.
In addition, even for programming languages that do have a pathway to WASM, there are often rough edges. In a perfect world, you would simply add a
--wasm-wasi flag to your compiler. And while we are close for some languages like Rust, the community still has more work to do before every language has this same experience.
Golem Cloud is powered by WASM, a specification for a portable code format that is truly designed for the cloud era.
WASM is suitable for high-performance, low-latency applications, with portability across different architectures (ideal for edge computing), and has a highly secure, sandboxed design that improves performance and eliminates the need for containerization.
More than that, however, WASM has a compositional capability model that allows WASM programs to be run in special ways that gives you many capabilities. Golem Cloud takes advantage of this unique design to execute WASM programs invincibly, through a customized runtime that has access to your program's memory and interactions.
WASM is still in its early days, but given how it's simplifying deployment and opening up new frontiers in cloud computing, this technology is here to stay, and I look forward to the day when all mainstream programming languages have robust support for targeting WASM.
Don't miss out on the latest insights, trends, and updates in invincible serverless computing. Subscribe to our newsletter and stay ahead with Golem at your fingertips.