I was just going to reply to this post and say “Wow, look at what the Co-Founder of Docker said!!”, but then I started looking deeper and had an “AH-HAH” moment:
https://discussion.fool.com/Post.aspx?mid=34561158&reply=tru…
This is the part that held enough “wow” to get me to start a reply:
“from the founder and CTO of Docker, arguably the most popular container technology. “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.” Twitter, March 2019. This underscores the cutting-edge nature of the technology underpinnings for Fastly’s serverless edge compute solution.”
Docker is THE container solution. For them to say they wouldn’t have needed to create Docker if they had this is amazing!! I didn’t know this and Docker is a big part of the tech I touch regularly.
Allow me to take a meandering route back to what this means to Fastly…
Before I go on, please understand this is more on the systems and virtualization side of tech, which is outside of my normal stomping grounds. I expect replies like “close but here are 5 things you got wrong”…so correct me if you know better! This should get close though.
Here is a technical description of what this is all about in the first two paragraphs of:
Mozilla Announces WASI Initiative to Run Web Assembly on All Devices, Computers, Operating Systems
https://www.infoq.com/news/2019/04/wasi-wasm-system-interfac…
"WebAssembly code across all devices, machines and operating systems. The new standard, WebAssembly System Interface (WASI), defines one single conceptual operating system interface, which can be implemented by multiple, actual operating systems. At the difference of previous “Run Anywhere” efforts like Java, WASI builds on WebAssembly, a rare collaboration between browser vendors and manufacturers of chips, devices, computers and operating systems to produce a patent-free, open standard. The WASI standard will strive to provide WebAssembly’s portability and security through a modular set of standard interfaces, and to provide a solid foundation for an ecosystem. Mozilla and Fastly are already shipping prototypal WASI implementations.
WASI aims to be a system interface for the WebAssembly platform (currently implemented by the four major browser engines). WebAssembly (Wasm) describes itself as a “binary instruction format for a stack-based virtual machine”, with the design goal to “execute at native speed by taking advantage of common hardware capabilities available on a wide range of platforms”. Wasm is used as a target for compilation of high-level languages like C/C++/Rust. While WebAssembly was primarily designed to run on the open web, Mozilla seeks now to extend WebAssembly’s reach to non-web embeddings, “including everything from minimal shells for testing to full-blown application environments e.g. on servers in datacenters, on IoT devices, or mobile/desktop apps”
…
WebAssembly is the result of a rare collaboration between browser vendors and major companies such as Microsoft, Google, Apple, Mozilla, Intel, Samsung and more.
…
WASI-enabled apps can currently be run in the browser with a polyfill, or outside the browser with Mozilla’s Wasmtime, or Fastly’s Lucet.
…
Solomon Hikes, co-founder of Docker, says:
If WASM+WASI existed in 2008, we wouldn’t have needed to created Docker. That’s how important it is. Webassembly on the server is the future of computing. A standardized system interface was the missing link. Let’s hope WASI is up to the task!
"
Note this has more to it than the original quote. He sounds a little more skeptical/hopeful here?
My Take…
First, for context, what is Docker? Docker is a container that bundles an environment and everything you need to run some software. It is fully self-contained, so you can drop it on any system and run it without worrying about what the person has installed on their computer (or does not have installed), what versions and if they are compatible, etc, etc, etc. There are a ton of advantages to distributing something “containerized” rather than shipping a list of prerequisites (dependencies) to install and configure just so, in an environment that can NOT be predicted (someones computer or server). It is simple to hand over a container instead. What Docker is NOT is a virtual machine.
A Virtual machine is an entire computer in a virtual box. For example, a virtual machine would need Windows, or Linux or Mac OS to be fully installed. Virtual machines are virtual though, so you can have a Windows virtual machine running in a window on your Mac (VMware is a popular one you can use at home and it is how I ran Quicken for Windows when I first moved to a Mac years ago). Virtual machines take almost as much time to start up as your computer does (they are lighter, but still a full OS). That is WAY TOO SLOW for server-less use. Can you imagine clicking on a button and having to wait for a computer to start up and get you the answer? Nope.
Enter non-persistent Docker containers. A request for some processing is received through a “hook” which triggers a Docker container to spin up and run the application inside it (a “service”) and get you your answer. You get a clean environment every time too, so you don’t have to worry about junk building up over time causing problems and resources being held up. When done, it simply closes the container, which also cleans itself up. No extra things running in the background all the time. This is great, but not fast enough for a company named Fastly!
Back to that technical article quote above…
So you have this platform that was already being used to build applications in browsers, WebAssembly (Wasm). It has been shipping with all major browsers since 2017. Basically programmers write code in the language they want and then compile it to this low level binary format that is small and can run and start up efficiently. You wouldn’t want to make it directly though, which is why we use high level programming languages AND THEN also write another program, called a “compiler”, that can take the human-created code and turn it in to something like Wasm here.
Then you add this very low-level layer, WebAssembly Interface (Wasi), that sits on the machine (any device, hardware) and can run WebAssembly like “normal” software on a computer. I guess this is essentially a thin layer installed on top of existing operating systems that presents a common interface able to run any existing web app? This means any web app can run on any device or any browser without having to worry about the details?
Getting to the Point…
I have been wondering what it is exactly that makes Fastly so…well…fast? Some have speculated it is taking some old tech and doing something on top of it that combined makes a new thing…huh? Well this is where all the stuff above comes together.
-
Fastly created Lucet, a WebAssembly compiler! And they open-sourced it. This means anyone out there can take something they wrote in any one of the many supported popular programming languages and compile it to be run on Fastly’s Cloud. The key is…
-
Lucet has another component, not previously discussed here, called a runtime [environment]. We know now that WebAssembly can run in browsers. Fastly wrote this thing that can allow that same application/service to run in their cloud. This is the key to the speed. They do not have to spin up containers with all the extras. They just make an “instance” of the WebAssembly app/service instead. They have full control over the runtime environment and can provide all the right stuff to run the apps and control every aspect of how they start up and run!
Fastly created a computing platform that is leaner and meaner because they have full control but also provided developers the ability to use what they are familiar with and a tool to ship the result to be executed in their cloud.
A point for the technically interested is that they aren’t even multi-processing here. They are running multiple instances in the same process. The resulting reduction in overhead here has to be really impressive. Something like multi-threading perhaps…?
In their words:
https://www.fastly.com/blog/announcing-lucet-fastly-native-w…
"A major design requirement for Lucet was to be able to execute on every single request that Fastly handles. That means creating a WebAssembly instance for each of the tens of thousands of requests per second in a single process, which requires a dramatically lower runtime footprint than possible with a browser JavaScript engine. Lucet can instantiate WebAssembly modules in under 50 microseconds, with just a few kilobytes of memory overhead. By comparison, Chromium’s V8 engine takes about 5 milliseconds, and tens of megabytes of memory overhead, to instantiate JavaScript or WebAssembly programs.
With Lucet, Fastly’s edge cloud can execute tens of thousands of WebAssembly programs simultaneously, in the same process, without compromising security. The Lucet compiler and runtime work together to ensure each WebAssembly program is allowed access to only its own resources. This means that Fastly’s customers will be able to write and run programs in more common, general-purpose languages, without compromising the security and safety we’ve always offered."
Here they are comparing their performance to the web runtimes but they don’t even touch on the fact they are displacing the “regular” programs shipping and running in containers too!
Of course if you want to play with Lucet it is free and you can get it in a Docker container to make it easy to play with ;). The container will have a runtime preconfigured for you to run your program and see if it does everything you want it to before you ship it to the cloud for primetime use “out in the wild”.
"Beyond the edge cloud
We are excited to open source Lucet because of all the possibilities WebAssembly holds beyond the web browser and edge cloud. For instance, Lucet’s support for WASI is a big step towards WebAssembly programs that can run on whatever platform the user wants — in the cloud, at the edge, on the browser, or natively on your laptop or smartphone — all while keeping the same strong guarantees about security in place. We want to enable WebAssembly to thrive inside any program that allows scripting or extensions, while using fewer resources than current solutions…"
What I am not real clear on is how big of a barrier to entry it would be for another company to create a runtime to support WebAssembled services. Mozilla is an open-source foundation that is already offering one called wasmtime (here is the code: https://github.com/CraneStation/wasmtime). It is mentioned in the Mozilla announcement piece above right next to Fastly. Can’t another company grab this, drop it on some machines and start hosting apps? Help me connect the dots because questions like this come from ignorance more often then not in situations like this!