quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.76k stars 380 forks source link

question, not an issue: What is the cost of open/close an unistream #1508

Closed szguoxz closed 1 year ago

szguoxz commented 1 year ago

I am trying to build a tunnel. I open a unistream, send the packet, and close the stream, then wait for the next packet. Is this too abusive? or should I open a stream, keep it alive, sending all the packets? will it be faster?

Ralith commented 1 year ago

Streams are very cheap. Depending on what exactly you're tunneling, you might also want to consider using datagrams. Sending multiple packets in a row on a single stream will expose them to head-of-line blocking, which may or may not be a problem for you depending on what you're tunneling.

neevek commented 1 year ago

Streams are very cheap. Depending on what exactly you're tunneling, you might also want to consider using datagrams. Sending multiple packets in a row on a single stream will expose them to head-of-line blocking, which may or may not be a problem for you depending on what you're tunneling.

Hi, @Ralith, By using datagrams, does it mean I have to handle packet reordering and packet retransmitting myself like using UDP?

djc commented 1 year ago

Hi, @Ralith, By using datagrams, does it mean I have to handle packet reordering and packet retransmitting myself like using UDP?

Yes.

Ralith commented 1 year ago

Closing as the question appears to have been answered.