Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Support wasi:http/proxy world in wasmtime shim #416

Closed
Mossaka opened this issue Dec 5, 2023 · 6 comments · Fixed by #691
Closed

Feature: Support wasi:http/proxy world in wasmtime shim #416

Mossaka opened this issue Dec 5, 2023 · 6 comments · Fixed by #691
Labels
enhancement New feature or request wasmtime Anything wasmtime shim related

Comments

@Mossaka
Copy link
Member

Mossaka commented Dec 5, 2023

This is a feature request for enhencing the capability of the wasmtime shim this repo provides.

Motivation

WASI HTTP proposal has reached phase 3, meaning it provides a new phase of stability. It is one of the two WASI worlds that are developed alongside with WASI preview 2. While #401 enables wasm component support in wamtime shim, it assumes the world the components are targeting to is wasi:cli/command which is POSIX main function. This proposal acts as an extension to #384 to support the wasi:http/proxy world.

wasi:http/proxy defines a collection of interfaces for sending and receiving HTTP requests and responses. The host implementation is currently supported by wasmtime v15.0.1 (e.g. via wasmtime-wasi-http crate), and wasmtime CLI provides a nice serve command handle HTTP requests from wasm files.

Feature Request

  • Either extend the current wasmtime shim or create a new wasmtime-serve shim to execute wasm components targeting wasi:http/proxy world.
  • Ensure full compatibility with wasm modules and the existing the worlds wasi:cli/command supported by the wasmtime shim.
  • Extensive testing to validate that wasmtime serve is correct, functional and performant.
@Mossaka Mossaka added bug Something isn't working enhancement New feature or request and removed bug Something isn't working labels Jan 2, 2024
@Mossaka Mossaka added the wasmtime Anything wasmtime shim related label Apr 18, 2024
@matsbror
Copy link

I am really interested in this support. Is someone working on this?
It is not as easy as to upgrade wasmtime to version 18 or higher?

@Mossaka
Copy link
Member Author

Mossaka commented Apr 28, 2024

Thanks! There isn't anyone working on this as far as I know, so feel free to take it on.

It is not as easy as to upgrade wasmtime to version 18 or higher?

I am afraid it's going to be more involved than just upgrading wasmtime to a higher version. As of today, the wasmtime shim only supports the wasi:cli world to be able to execute CLI programs. Supporting wasi:http/poxy means that the shim itself needs to start a HTTP server, listen to requests, and then invoke the handle function that is exported by the wasm components.

If I would implement this, I will make it very similar to how wasmtime serve command works in the wasmtime repo. (e.g. serve.rs). I would even try to make the functionalities in wasmtime serve as much reusable as possible so we don't have a large chunk of duplicated code.

Hope this helps and as usual don't hesitate to ask more questions and reach out. Happy to help!

@matsbror
Copy link

Thanks! There isn't anyone working on this as far as I know, so feel free to take it on.

I'm afraid I know too little about the inner workings of runwasi to make this in a productive manner, but I will try and we'll see how it goes.

I am afraid it's going to be more involved than just upgrading wasmtime to a higher version. As of today, the wasmtime shim only supports the wasi:cli world to be able to execute CLI programs. Supporting wasi:http/poxy means that the shim itself needs to start a HTTP server, listen to requests, and then invoke the handle function that is exported by the wasm components.

I naïvely thought that the shim could just call the cli tool wasmtime serve but I guess I need to see how the wasmtime shim is implemented now.

@Mossaka
Copy link
Member Author

Mossaka commented May 1, 2024

Yeah the shim is using wasmtime APIs to load, compile and run the wasm binaries. Supporting wasmtime serve means to use wasmtime APIs to achieve the same functionalities that wasmtime serve does.

@Mossaka
Copy link
Member Author

Mossaka commented Oct 26, 2024

@matsbror we have implemented the wasi:http proxy support in Wasmtime Shim thanks to @andreiltd 's work. Let me know if you this helps your work! #691

@matsbror
Copy link

Thank you! I will have a look!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request wasmtime Anything wasmtime shim related
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants