Monday, November 7, 2022

 

TECH


WebAssembly (Wasm): the future of cloud computing

Whether on the server or at the edge, 'WebAssembly (Wasm)' lets you create custom logic that runs much closer to your data than ever before. It can also be carried out more flexibly, safely and efficiently.

Wasm, short for WebAssembly, was developed for the web. But Wasm technology goes beyond web browsers. Now companies are starting to run Wasm on the server side. SingleStore, for example, uses Wasm in its database.

Some think Wasm will replace container technology and ubiquitous JavaScript. Believe it or not, Wasm is clearly having an impact on cloud computing. Why and how?

Wasm is cross-platform: assembling cloud components safely and simply...Many different languages ​​are used to write software. It is difficult to guarantee the interaction of so many languages. Wasm provides a framework that allows users to write in any language they want. It then generates a common simulated machine language form.

This format allows components written in various languages ​​such as Rust, C/C++ and Gorang to communicate with each other. Wasm also incorporates components from other languages ​​without having to check or care how server-side systems (eg databases, etc) created these modules.

Suppose Wasm is a generic plug-in format and you want to enhance your system's functionality with components developed by third parties. Wasm allows you to bring new components into your system without the risks normally associated with adding additional features. For example, an external component can cause the system to crash or behave unexpectedly. Wasm alleviates this problem by creating a very secure framework for the interaction of different systems and components.

The cloud is a major driving force behind Wasm's expansion. Wasm is suitable for the cloud because it is virtualized and can work in any environment that supports the Wasm runtime. Furthermore, cloud systems consist of various services connected in different ways. That said, it can get tricky. The simpler the cloud environment, the easier it is to work together different aspects of a cloud system.

Wasm is safe: the way code is executed and functions are expressed reduces risk...In most language runtimes, functions have addresses. These addresses are executable points in memory. Seeing memory as a bunch of bytes makes a function indistinguishable from the rest of memory. So you have to find a function and inject the code, or call the function and open the door so the function can do something the function shouldn't do. The Wasm project solves this problem.

Wasm presents functionality in a way that cannot be exploited. It also alleviates common security concerns associated with running untrusted code by running code in a sandbox. As Wasm encapsulates program memory in a secure area, it cannot access other locations that could affect the host running the program or compromise security.

In addition, Wasm's resource-based security model allows the host to control what kind of operations the Wasm program is authorized to perform. For example, if file access is required, the host must explicitly grant directory access.

Wasm is fast: removes unnecessary stuff, improves speed and efficiency... Clearly Wasm is not the first technique used to gather elements more securely and simply. But Wasm is obviously much faster than the other techniques.

Compilers can use the LLVM backend to compile to LLVM intermediate representations (IRs) to generate Wasm programs. An LLVM, or low-level virtual machine, is a mined machine on which many languages ​​are already compiled. Because of this approach, and thanks to years of community effort around the LLVM project, Wasm programs are compiled into highly optimized machine code.

Singlestore created the ‘Wasm Space Program’, a real-time virtual space inside the database to show how fast and light Wasm is. In this simulation, the spacecraft uses various strategies to replenish energy and fight other spacecraft in a vast 'space' in real time. Naturally, there is a lot of data involved, for example the system has over 1 million ships and about 3 million database updates per second.

In the past, a lot of data had to be brought into the middle tier to consolidate that data and combine it into the middle tier. This could cause significant delays, and a complex cache was required to get real-time responses. Instead of taking this approach, each ship's strategy was written in Wasm and loaded into a database as UDF. Every second, each spacecraft's strategy function is called to determine its next move.

The front end (the JavaScript program running in the browser) has no understanding of these strategies or the state of the universe. It executes SQL queries directly against the database and only does the work of graphically displaying the information returned. The database maintains all state information and Wasm is much faster because it operates very close to the data. An intermediate layer is not even necessary.

Wasm can also be used to solve many other applications and use cases. For example, you can use Wasm for sentiment analysis. The complex logic required for sentiment analysis cannot be easily expressed in the SQL language of the database. So this requires building a sophisticated language and downloading each row of data to get the data. Next, you need to send the sentiment analysis rating back to the database. In other words, it means a round trip for each row of the database being used. Having millions of lines generates a lot of network traffic. However, if you use the wasm integration method on single storage, there is no overhead because it is already in the database.

Wasm is always getting better: making patterns makes them stronger...Wasm is already very capable. And new technologies and standards will allow Wasm to do more. For example, the W3C WebAssembly Community Group is currently working to standardize the Web Assembly System Interface (WASI) supported by the Bytecode Alliance and the like.

WASI will provide a set of standard APIs and services that the Wasm module can use when running on the server. What you do in other programming languages ​​can't always be mapped to Wasm because many standard proposals like garbage collection, network I/O and threading are still in the works. Ultimately, however, WASI aims to provide a complete standard that will help achieve this. The goals of WASI are in many ways similar to those of POSIX.

Current Wasm doesn't even address the ability to connect or communicate with other Wasm modules. However, the Wasm community is working on creating a component model with support from members of the computer industry. It aims to create a dynamic connected infrastructure around the Wasm module, defining how components initiate and communicate (similar to the process model of traditional operating systems).

In addition, a new standard IDL syntax called Web Assembly Interface Types (WIT) allows people to describe Wasm interfaces in a language-independent way. As a result, the binding generator can take what's in the IDL and compile the code with which the Wasm host and guest exchange data in a common way.

Wasm is the future: it provides a faster, safer and more efficient way to integrate...It's true that Wasm is lightweight, but it's not a quick replacement for containers. However, it is expected to be part of many software in the future. Because Wasm allows you to create custom logic that runs much closer to your data, whether on the server or at the edge, and it can be done securely, efficiently, and flexibly.

Singlestore now allows you to compile your existing programs in Wasm, place them in your database and run them. That means you don't have to rewrite your code and put it where there is no data. With Wasm technology, you get the best of both worlds.

Source: ciokr@idg.co.kr

No comments:

Post a Comment

DIGITAL LIFE Why the future of AI depends on trust, safety, and system quality When Daniel Graham, an associate professor in the University ...