Skip to content

feat(cca): BBR - #1151

Merged
djc merged 1 commit into
quinn-rs:mainfrom
FrankSpitulski:feat/bbr
Oct 30, 2021
Merged

feat(cca): BBR#1151
djc merged 1 commit into
quinn-rs:mainfrom
FrankSpitulski:feat/bbr

Conversation

@FrankSpitulski

Copy link
Copy Markdown
Contributor

implements BBR congestion control based on google's quiche. There are some differences in implementation due to chromium's CCA having a different API, especially around sending vs acking packets.

It's a pretty rough first implementation but from my testing it seems to work well. It is very resistant to packet loss especially in high BDP situations.

Please critique and suggest changes as needed.

I've added additional fields and traits for debugging using stats which can be removed if needed.

Closes #693

@Matthias247 Matthias247 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool to see BBR is integrateable and to hear it performs good! Definitely interested to see this landing.

I did a short skim on this, but comments are mostly stylistic since I don't have any background on BBR.

Since this is rather complex, I would be interested to see some tests as part of these changes. Ideally also in the form that show the benefits compared ot the other congestion controllers.

Comment thread quinn-proto/src/congestion.rs Outdated
Comment thread quinn-proto/src/congestion.rs Outdated
Comment thread quinn-proto/src/congestion.rs Outdated
Comment thread quinn-proto/src/congestion.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
// Compute how many bytes are expected to be delivered, assuming max
// bandwidth is correct.
let expected_bytes_acked = max_bandwidth
* (now - self.bbr_aggregation_epoch_start_time.unwrap_or(now)).as_micros() as u64

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you probably want now.saturating_duration_since(...) for safety reasons and conciseness

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, but it doesn't look any more concise to me. can you make sure it's what you intended?

Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion/bbr_min_max.rs Outdated
Comment thread quinn/src/connection.rs Outdated

@Ralith Ralith left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, this looks pretty cool! Reviewed mostly for style and API impact for now, since I don't presently have time to dig deep into correctness, and it's not clear what the best reference would be to derive such a review from either.

Comment thread quinn-proto/src/congestion/bbr_min_max.rs Outdated
Comment thread quinn-proto/src/congestion/cubic.rs Outdated
Comment thread quinn-proto/src/congestion/cubic.rs Outdated
Comment thread quinn-proto/src/connection/mod.rs Outdated
Comment thread quinn-proto/src/congestion.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn/src/connection.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
@FrankSpitulski
FrankSpitulski force-pushed the feat/bbr branch 3 times, most recently from 208cd2c to cdb93b8 Compare July 12, 2021 17:19
Comment thread quinn-proto/src/congestion/cubic.rs Outdated
Comment thread quinn-proto/src/congestion/cubic.rs Outdated
@FrankSpitulski

Copy link
Copy Markdown
Contributor Author

@Ralith is this still in the pipeline?

@Ralith

Ralith commented Aug 12, 2021

Copy link
Copy Markdown
Collaborator

Yeah, sorry, just on limited bandwidth at the moment. I am looking forward to getting this in.

@djc

djc commented Sep 30, 2021

Copy link
Copy Markdown
Member

@FrankSpitulski this is ready for review, right? Mind marking it as such?

@FrankSpitulski

Copy link
Copy Markdown
Contributor Author

@Ralith I'm not sure what to do about this audit failure after rebasing. It's complaining about a vulnerability in the chrono package, but I haven't touched the deps.

@djc

djc commented Oct 25, 2021

Copy link
Copy Markdown
Member

@FrankSpitulski feel free to ignore that for now, it is irrelevant to this PR.

@Ralith Ralith left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your patience, and for keeping this rebased! I don't feel able to review the internal logic here in depth at present, but I'm happy to merge it as non-default with the experimental disclaimer. Reviewed mainly for style/clarity; I think we should be able to merge this shortly.

Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion.rs Outdated

@djc djc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also added some style notes. Thanks for all of your work on this!

Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/congestion/bbr.rs Outdated
Comment thread quinn-proto/src/connection/mod.rs Outdated
Comment thread quinn-proto/src/connection/mod.rs Outdated
Comment thread quinn/src/connection.rs Outdated
@FrankSpitulski
FrankSpitulski force-pushed the feat/bbr branch 2 times, most recently from 7c242a0 to 8425311 Compare October 29, 2021 00:20
Comment thread quinn-proto/src/congestion/bbr/bw_estimation.rs Outdated
Comment thread quinn-proto/src/congestion.rs Outdated
Comment thread quinn-proto/src/config.rs Outdated
Comment thread quinn-proto/src/congestion/bbr/mod.rs Outdated
Ralith
Ralith previously approved these changes Oct 29, 2021

@Ralith Ralith left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

squashed messages:

fixup for docs and removing extra braces

add downcasting hatch

pretty print should be Display, not Debug

un-needed export

fmt and clippy

re-expose CCAs to public API

reorder constants

inline bbr_state

remove extra param

refactor bbr into its own module

refactor bbr into its own module

no threadlocal rng, use genrange

rename fields for review

Update quinn/src/connection.rs

Co-authored-by: Benjamin Saunders <ben.e.saunders@gmail.com>

Update quinn-proto/src/connection/mod.rs

Co-authored-by: Benjamin Saunders <ben.e.saunders@gmail.com>

Update quinn-proto/src/connection/mod.rs

Co-authored-by: Benjamin Saunders <ben.e.saunders@gmail.com>

fill() now supported

clippy in cubic was covered by the rebase

add links to BBR info

refactor to hide internal PathData

clarify BBR usage

reduce struct scope

collapse update_last_sent into on_sent

collapse on_loss into on_congestion_event

remove dead code

Update quinn/src/connection.rs

Co-authored-by: Benjamin Saunders <ben.e.saunders@gmail.com>

Update quinn-proto/src/congestion/bbr.rs

Co-authored-by: Benjamin Saunders <ben.e.saunders@gmail.com>

Update quinn-proto/src/congestion.rs

Co-authored-by: Benjamin Saunders <ben.e.saunders@gmail.com>

Update quinn-proto/src/congestion/cubic.rs

Co-authored-by: Benjamin Saunders <ben.e.saunders@gmail.com>

clippy

safer duration comparison

backwards compatibility fill

add docs, rename stats cca to congestion

remove PacketNumber and bbr_ prefixes

rename constants to rust style

fix packet number typing

enable drain to target bdp mode during probe bw

add ack aggregation for better target growth

fix not entering growth mode

remove extra debug printing

enable rtt probe and track min rtt

track max bandwidth with minmax filter

use minmax filter for max bandwidth estimation

switch minmax filter to use round counts instead of times

port minmax filter to rust

fix: count lost packet size instead of their id

fix bw estimation not updating current bw

expose congestion configs

split bytes acked from end ack method

simplify full bandwidth check

remove some unused variables

add 125% of target full bandwidth condition as per docs

fix loss resetting too early, fix bandwidth target units of measurement

check if full bw reached

calculate recovery window

calculate cwnd

calculate pacing rate

maybe_enter_or_exit_probe_rtt

update gain cycle phase

refactor bandwidth estimation

add cca into stats for debugging

add target window

add recovery state transitions

loss recording

bandwidth estimation
@FrankSpitulski

Copy link
Copy Markdown
Contributor Author

had to rebase @Ralith

@djc
djc merged commit 7c04a15 into quinn-rs:main Oct 30, 2021
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 this pull request may close these issues.

BBR congestion control

4 participants