quinn-rs / quinn

Async-friendly QUIC implementation in Rust
Apache License 2.0
3.85k stars 394 forks source link

How to disable ack? #1265

Closed go-jar closed 2 years ago

go-jar commented 2 years ago

When transmitting a video stream, write_all() takes a long time, so I want to disable ack. May I ask how to disable ack?

Ralith commented 2 years ago

ACKs have nothing to do with how long it takes to send data. How much bandwidth are you using? Is the link saturated?

go-jar commented 2 years ago

ACKs have nothing to do with how long it takes to send data. How much bandwidth are you using? Is the link saturated?

The write_all() generally takes 40ms, which is approximately equal to rtt. If there is no ack, will it take less time?

Ralith commented 2 years ago

No. If you're not saturating the link (are you?) you may be limited by flow control, which is up to you to configure appropriately.

go-jar commented 2 years ago

May I ask how to check if the link is saturated?

Ralith commented 2 years ago

Compare the rate that you're exchanging data with the rate that the network path between you and your peer is capable of supporting. This is usually determined by the plan you have from your service provider, on both ends.

go-jar commented 2 years ago

Compare the rate that you're exchanging data with the rate that the network path between you and your peer is capable of supporting. This is usually determined by the plan you have from your service provider, on both ends.

Thanks! I still have a question, does write_all().await will end until all sent data received ack?

go-jar commented 2 years ago

I find that the link is not saturated. May be send_stream.finish().await will end until all sent data received ack. I made a mistake before, send_stream.finish() takes about 40ms, not send_stream.write_all().

Ralith commented 2 years ago

From the documentation:

[SendStream::finish] completes when the peer has acknowledged all sent data

If you don't want to wait for the peer to acknowledge everything, don't await on finish. It's entirely optional to do so.

go-jar commented 2 years ago

From the documentation:

[SendStream::finish] completes when the peer has acknowledged all sent data

If you don't want to wait for the peer to acknowledge everything, don't await on finish. It's entirely optional to do so.

Thanks! But there is a note that futures/streams/sinks do nothing unless you .await or poll.

Ralith commented 2 years ago

Yes. You don't need to call finish at all.

go-jar commented 2 years ago

Yes. You don't need to call finish at all.

Thanks!