Comments (5)
Thanks for the suggestion! The proposed API seems a bit tricky because this is all happening in the context of a larger connection. Presumably if some other stream needs to send a packet and there's some space left over in that packet, you wouldn't mind the stream packing its bits in with that packet?
Alternatively, could we get away with a flag that prevents the stream from triggering any packet sends, leaving it to the application to trigger sends immediately? This grants more control to the application at the cost of making its life a little harder (but might not be a big deal if your application has a clear idea of when it wants to send).
Another issue that I see is that "a packet size" worth of data isn't very deterministic, because it might depend on what else gets send in that packet how much space there is. So presumably you'd definitely like your data to piggyback on packets that are sent anyway, but you want to ensure some minimal outstanding buffer before a packet is triggered.
from quinn.
So this idea came from @Ralith on matrix, I tried to put it down in an issue but may have some pieces wrong. Please correct me if so.
It is indeed a good point that packets already send on the connection anyway are used to attach frames to. I don't think the idea of not fully sending the stream has to conflict with this. If you can attach a STREAM frame to the packet while still leaving unsent data in the stream then that can be done. But you wouldn't send a packet just because there is data in this stream, nor would you send the last bit of data of the stream because you might still need to set the FIN bit to that frame.
from quinn.
@djc raises some good points that weren't immediately obvious to me. In particular, not sending data on a packet that's outgoing anyway and has free space seems pessimal, but sending data while reserving at least one byte, even if there's room for it, to avoid finishing an application-layer message feels cheesy. Maybe we shouldn't try to solve that, since peers can avoid the problem robustly by reading to end anyway? Reducing unintended fragmentation with small application writes is probably independently useful.
from quinn.
Thought: if your application protocol is not intended to have any data following a certain message, you might want to detect cases where that isn't upheld (i.e. where the peer is badly behaved), which requires reading the stream until finished.
from quinn.
Another related but slightly different case: when opening a new connection and sending 0-RTT data, Quinn will typically send a padded 1200-byte UDP datagram bearing the Initial packet, followed by some number of datagrams bearing the 0-RTT data. This is inefficient; 0-RTT data could have been replaced the padding.
Deferring opening the connection will probably require a different API than deferring use of a single stream... but maybe stream granularity isn't a complete solution anyway? For example, you might want to buffer up small writes to multiple streams before sending a packet...
from quinn.
Related Issues (20)
- 0-RTT packets can be lost due to race condition introduced along with Incoming HOT 1
- Debug formatting could be improved HOT 1
- GSO padding has high overhead for application datagrams larger than half MTU
- Consider more aggressive GSO batching
- stream sending buffer size and how much left HOT 3
- ECN interop failures HOT 3
- aggressive open_bi HOT 1
- Create my own AsyncUdpSocket HOT 1
- "SendableFrames was SendableFrames { acks: false, other: true }, but only ACKs have been written" HOT 11
- Black hole detection false-positives HOT 5
- Expose Packet Decoder? HOT 2
- ReadExactError::FinishedEarly byte count is sometimes incorrect HOT 1
- How to receive data in blocking way HOT 3
- Inconsistent documentation on platform availability of `local_ip` HOT 3
- long running bi stream HOT 5
- seems like quinn 0.11 not working well under heavy load HOT 12
- API for awaiting for stream reset on the reader HOT 5
- build fails on Solaris HOT 4
- Rotation of Connection IDs HOT 5
- How to run insecure connection example? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from quinn.