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

Document that chunking boundaries aren't preserved in streams #189

Open
martinthomson opened this issue Feb 3, 2021 · 4 comments
Open
Labels
Editorial This is an editorial PR that can be merged by editors without discussion

Comments

@martinthomson
Copy link
Member

A stream of datagrams will preserve boundaries between each chunk, even as those chunks traverse the network.

However, unidirectional and bidirectional streams won't preserve the boundaries between chunks.

Write that down so that people understand this, otherwise they might be surprised: one thing that can happen in local testing is that with small writes, the chunks are preserved, but this isn't a guarantee and once you add load, latency, and loss, people might be surprised at the outcome.

@jan-ivar
Copy link
Member

jan-ivar commented Feb 3, 2021

with small writes, the chunks are preserved, but this isn't a guarantee and once you add load, latency, and loss, people might be surprised at the outcome.

For example, a simple text-chat app over a bidirectional bytestream may appear chunked by message, until after a network blip when you may receive a backlog of text all at once. You'll need to rely on some other message separator, like newlines, or a notation like JSON.

@aboba
Copy link
Collaborator

aboba commented Feb 4, 2021

@jan-ivar Is it always true that a stream of datagrams will preserve boundaries between chunks? For example, what happens if datagram transport is emulated over a reliable transport (e.g. emulated datagram transport over HTTP/2)? Can we assume that we are only talking about HTTP/3 datagrams (which are not on the standards track) for now?

@martinthomson
Copy link
Member Author

My expectation is that any emulation would add framing so that boundaries could be preserved.

@wilaw wilaw added the Editorial This is an editorial PR that can be merged by editors without discussion label Jun 2, 2021
@yutakahirano yutakahirano added this to the No mileston milestone Jun 30, 2021
@jan-ivar jan-ivar changed the title Preserving chunking boundaries Document that chunking boundaries aren't preserved in streams Mar 30, 2022
@jan-ivar
Copy link
Member

This 2021 TPAC slide has some illustrations that might prove useful.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Editorial This is an editorial PR that can be merged by editors without discussion
Projects
None yet
Development

No branches or pull requests

5 participants