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

Stream chunked data out of guest modules instead of buffering #115

Open
technosophos opened this issue Aug 25, 2021 · 4 comments · May be fixed by #136
Open

Stream chunked data out of guest modules instead of buffering #115

technosophos opened this issue Aug 25, 2021 · 4 comments · May be fixed by #136

Comments

@technosophos
Copy link
Contributor

Right now we buffer the entire HTTP payload before sending to the client. That is really bad performance for things like images. We should instead be able to send chunked data to the client.

@technosophos
Copy link
Contributor Author

/cc @fibonacci1729

@itowlson
Copy link
Contributor

Do you envisage asyncifying the call into the module, so that we can be returning the first bytes of the response as soon as the Wasm code produces them? Or are you just thinking of trying to reduce the copies between the stdout pipe, the buffer and the response body object?

@itowlson
Copy link
Contributor

Why did I think we would need to asyncify the call into the module? Well, we can't map stdout into a pipe that feeds directly into the response stream, because we need to do some processing on the beginning of the stream to convert top matter to headers. But I wonder if we could do that with some clever pipe/stream infrastructure so that it happens automatically as data is written to/read from the pipe.

#ThingsThatSoundEasierThanTheyInevitablyTurnOutToBe

@radu-matei
Copy link
Member

bytecodealliance/wit-bindgen#82 and streams should help with this.

@itowlson itowlson linked a pull request Nov 22, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants