Replies: 4 comments
-
Why WASM? Why WASM filtersWith WASM filter implementations we get:
Translation: '* Maintainability - We do not need to modify the Envoy's codebase in order to enhance its functionality.
It also has a few drawbacks that need to be taken into consideration:
Backgroup for WASM in EnvoyAs of early 2019, Envoy is a statically compiled binary, with all its extensions compiled at build-time. This means that projects that provide custom extensions (e.g. Istio), must maintain and distribute their own binaries, instead of using the official and unmodified Envoy binary. For projects that don’t control their deployment, this is even more problematic, because any updates and/or bug fixes to extensions require building new binary, producing release, distributing it, and more importantly, re-deploying it in production. Translation: 'For projects that don't have control over their deployment, this becomes even more problematic, as any updates and/or bug fixes to extensions necessitate building a new binary, generating a release, distributing it, and, most importantly, redeploying it in production. This also means that there is often a version drift between deployed extensions and the control plane configuring them. While parts of the issue could be solved using dynamically loadable C++ extensions, this isn't a feasible solution at this time because, due to the rapid pace of Envoy development, there is no stable ABI or even API for the extensions. More often than not, updating Envoy requires code changes, which makes updating a manual process. Instead, we've decided to address this problem by writing and delivering Envoy extensions in WebAssembly with a stable ABI since it brings many additional benefits (described below). Benefits for WASM in Envoy
Drawbacks for WASM in Envoy
|
Beta Was this translation helpful? Give feedback.
-
About WASM runtime in Envoy. Wasm VMsWhen a Wasm module is loaded into Envoy, it is executed within its own isolated Wasm VM. Currently, there are a few different options available:
WAVMWAVM is also meant to be used in this kind of scenario where it is embedded in another application, though I think with quite different trade-offs from wasmjit. It uses libc and LLVM. LLVM is quite heavy-weight in terms of both code size and the time it takes to translate the WebAssembly code to native code. It wouldn't make sense in a browser VM, but may be well-suited to an application that compiles a WebAssembly module once at startup, and spends a lot of time running the generated code. WAVM uses signal handling to make bounds-checking of memory accesses as fast as possible. I believe that v8 supports both signal handling and a slower fallback if installing a signal handler isn't possible. I am very curious to know what your constraints around signal handling are:
WASM Runtimes in Envoy
Another one, wasmer, 7.5K star, The leading WebAssembly Runtime supporting WASI and Emscripten. High-level overview For WASM in EnvoyWith Proxy-Wasm, developers can write proxy extensions using their programming language of choice, On the proxy side, once a Wasm module is loaded (either directly from disk or pushed from the For each of Envoy's extension types, we have created a shim that translates the extension's interface. Virtual machines for WASM in EnvoyWhen the Wasm runtime instantiates a Wasm module, it creates a Wasm virtual machine (VM instance) There are a few models for mapping between VM instances and Proxy-Wasm extensions. Ultimately, it's.
|
Beta Was this translation helpful? Give feedback.
-
Based on WebAssembly Envoy Extension —— GetEnvoy Extension Toolkit Introduction The This way, you can deeply customize without modifying Envoy's source code. Unlike scripts, WASM extensions are also written in Rust or Go, with complete testing and control, and can achieve high quality.
|
Beta Was this translation helpful? Give feedback.
-
Refer to Nginx supports JS extension. To involve JS developers in audio and video, it can only be done through the JS extension method (like Nginx), not the Node.js method. Using Node.js is like rewriting and has the same idea as Pion, which is not a good path because the main technology stack for audio and video is still C and cannot be changed. JS extensions allow JS developers to implement their own business under the existing audio and video framework, rather than implementing the entire audio and video framework. In the early days, Adobe AMS server supported AS extensions, which were similar to JS but not exactly the same. The main problem was that AMS itself was not open source, so features that should have been done in AMS could only be implemented in AS, resulting in extremely bloated and unmaintainable AS. Therefore, SRS has not done extensions to avoid what should have been done in SRS being implemented in extension languages, which is also a disaster. SRS later researched WASM and found that it is also an extension mechanism, but it is more about solving the problem of programmers writing extensions in multiple languages, such as cloud-native languages that need to be supported. Most of them are for existing frameworks to be able to access. SRS's main goal is not to connect to existing systems but to connect to Node.js community developers. Therefore, the problem is clear: SRS must and only needs to support JS extensions, just like Nginx supports JS.
Next, some research needs to be done, including JS runtime and the degree of fit with ST coroutines. |
Beta Was this translation helpful? Give feedback.
-
We believe that if a streaming server supports an extension language (or scripting language), such as Nginx supporting the Lua scripting language OpenResty, it will cause a disaster of script misuse. This issue has been previously described in comparing Nginx.
Video (or streaming) servers are very complex business servers. If there are scripts that can write complex logic, users generally tend to use scripts for customization, resulting in a huge amount of unmaintainable script code.
Of course, users can also write large and unmaintainable C/C++ code, which ultimately makes our support for scripting languages seem not so evil. If the script is strictly limited, it can be considered.
More importantly, the current situation has changed. SRS's code is increasing, and the core protocols supported are becoming more and more diverse, from RTMP+HLS to the addition of SRT, GB28181, and WebRTC. SRS has no intention of using scripts to implement new protocols. We still believe that video servers should be carefully implemented in C++ and ensure quality, while scripting languages seem inherently difficult to achieve high quality.
As for Lua or WASM, I prefer WASM, so that multiple languages can be used to extend SRS, rather than being limited to Lua.
As for WASM or JS, I prefer JS because the main target group is JS rather than all languages. WASM is mainly for supporting all language extensions, generally for adapting legacy system migration, such as in cloud-native scenarios, Envoy supports WASM extensions, and any backend language can connect its existing language to Envoy. Obviously, SRS's main target is JS, not all languages, nor legacy systems.
Of course, some research needs to be done, especially the degree of fit between ST and JS Runtime, thread model, etc.
Beta Was this translation helpful? Give feedback.
All reactions