简体   繁体   English

Wasmtime WASI 通过 HTTP/sockets 通信

[英]Wasmtime WASI communication via HTTP/sockets

There is awesome webassembly compiler&vm named Wasmtime, which provide support for execution without any kind of embedding, which allows run WASM applications direcly from command line https://docs.wasmtime.dev/lang-bash.html有一个很棒的名为 Wasmtime 的 WebAssembly 编译器和虚拟机,它提供对执行的支持而无需任何类型的嵌入,它允许直接从命令行运行WASM应用程序

Unfortunately there is no official way to perform HTTP/network communication via WASI, since HTTP/sockets are not present in WASI preview snapshot, so developing any useful application via Wasmtime is problematic不幸的是,没有通过 WASI 执行 HTTP/网络通信的官方方法,因为 WASI 预览快照中不存在 HTTP/套接字,因此通过 Wasmtime 开发任何有用的应用程序都是有问题的

Pure theoretically is't possible to run some proxy network server, which issuing real TCP connections from the host and communicate with Wasmtime application via filesystem over custom protocol, but it seem to be overcomplicated and maybe impact bad performance纯理论上不可能运行一些代理网络服务器,它从主机发出真正的 TCP 连接并通过自定义协议通过文件系统与 Wasmtime 应用程序通信,但它似乎过于复杂并且可能会影响糟糕的性能

There is solutions like https://github.com/deislabs/wasi-experimental-http , but it is not suitable since requires wrining custom entrypoint in Rust, installing Rust toolchain and compiling it for bunch of target platforms, instead of downloading standalone executalbe file from trusted web-site here https://wasmtime.dev/ There is solutions like https://github.com/deislabs/wasi-experimental-http , but it is not suitable since requires wrining custom entrypoint in Rust, installing Rust toolchain and compiling it for bunch of target platforms, instead of downloading standalone executalbe来自受信任网站的文件https://wasmtime.dev/

Several weeks ago I opened issue https://github.com/bytecodealliance/wasmtime/issues/3483 , but unfortunately there is no progress or answer on it几周前我打开了问题https://github.com/bytecodealliance/wasmtime/issues/3483 ,但不幸的是没有进展或答案

So main questing addresses to Wasmtime team: how it meant to develop read-world applications with Wasmtime runtime, if any communication functionality is not avaiable?因此,Wasmtime 团队的主要任务是:如果任何通信功能不可用,那么使用 Wasmtime 运行时开发读取世界应用程序意味着什么? Same time exotic extensions like neural networks are actively developed, hovewer HTTP/raw sockets support are most MVP part同时,像神经网络这样的外来扩展正在积极开发中,但是 HTTP/raw sockets 支持是大多数 MVP 部分

Thanks谢谢

The main answer to this is unfortunately that no, WASI is not yet ready for this kind of thing, but it is heading in that direction.不幸的是,对此的主要答案是不,WASI 还没有为这种事情做好准备,但它正朝着那个方向前进。

For context, I'm the founder/maintainer of Suborbital就上下文而言,我是Suborbital的创始人/维护者

We, for example, created our own custom set of 'cloud APIs' on top of the major Wasm runtimes (Wasmtime, WasmEdge, Wasmer), and expose them as a Go library .例如,我们在主要的 Wasm 运行时(Wasmtime、WasmEdge、Wasmer)之上创建了我们自己的自定义“云 API”集,并将它们公开为Go 库 At the very least you don't need custom versions of anything, we bundle the runtime along with the library.至少您不需要任何自定义版本,我们将运行时与库捆绑在一起。

For now this is the best option, but the hope is that WASI will obviate the need for custom SDKs/APIs like ours in the future.目前这是最好的选择,但希望 WASI 将在未来消除对像我们这样的自定义 SDK/API 的需求。

Happy to answer any questions you might have!很高兴回答您可能遇到的任何问题!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM