1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-09 10:00:57 +03:00
Commit Graph

343 Commits

Author SHA1 Message Date
Joseph Beshay
6e3cddc5a4 Ignore incoming knob frames if we haven't advertised knob support
Summary: Only accept knob frames if support has been advertised.

Reviewed By: hanidamlaj

Differential Revision: D48329363

fbshipit-source-id: 3f06574415d95a2129e5d776b7a4f4808791ed45
2023-08-16 10:24:01 -07:00
Joseph Beshay
7059e2f13e Log the congestion controller type to qlog
Summary: With bbr, bbr_testing, and bbr2 there is no way to tell the difference between qlog traces especially during Startup. This explicitly logs whenever the congestion controller is created or changed.

Reviewed By: hanidamlaj, mjoras

Differential Revision: D48194475

fbshipit-source-id: 30ba5662e0fe4aa2ccb4b28696049d8aadab38db
2023-08-10 20:03:02 -07:00
Joseph Beshay
0ef984e147 Use BBRTesting to test experimental pacer settings
Summary: Change BBRTesting to test the existing BBR CCA when replacing the pace scaling factor by the experimental pacing improvements.

Reviewed By: kvtsoy

Differential Revision: D48120180

fbshipit-source-id: 6b99754ae0f8cb7a76596243a112ddd500f6fcc8
2023-08-10 20:03:02 -07:00
Joseph Beshay
502d26d19b Do not attempt to configure the pacer before it's allocated
Summary: When BBR2 is configured on the server side, the pacer may not be allocated yet when setCongestionControl is called.

Reviewed By: hanidamlaj

Differential Revision: D47881213

fbshipit-source-id: ddb695dbb5d5d8c07ccef5e7282babdb661482b3
2023-07-28 18:43:20 -07:00
Konstantin Tsoy
9823ea87e2 Add bufAccessor to the client
Summary: Add bufAccessor to the client

Reviewed By: jbeshay, mjoras

Differential Revision: D47649494

fbshipit-source-id: e14049d3556c01a3c61b9264d43e1304d781232d
2023-07-27 17:00:41 -07:00
Joseph Beshay
d85f726e36 Consolidate logic for setting the congestion controller in one function
Summary: Ensure all CCA-related settings are included in setCongestionControl(), and that it's called from the knob setting the congestion controller.

Reviewed By: kvtsoy

Differential Revision: D47741830

fbshipit-source-id: ff1d2347581c61a58f2caaff8189126930bf4e04
2023-07-25 19:48:01 -07:00
Matt Joras
80fd271483 Default max nexts to 5 for DSR.
Summary: This has empirically shown good results in experiments with no downside. Only set it if the transport setting hasn't been overridden already.

Reviewed By: jbeshay

Differential Revision: D47447380

fbshipit-source-id: 294582544b6e42d7f6c46d1d810228a0b5fad9e8
2023-07-17 12:12:45 -07:00
Konstantin Tsoy
401f72867a Use QuicBackingEventBase instead of folly::EventBase
Summary: Use QuicBackingEventBase instead of folly::EventBase

Reviewed By: mjoras

Differential Revision: D47135548

fbshipit-source-id: c779d66a044bddb61586e2603a7d4bb4e96ac1a0
2023-07-13 18:39:45 -07:00
Konstantin Tsoy
4b83c1477f Do not call to evb observer for mvfst mobile
Summary: Will not be doing evb observers for now for mvfst mobile

Reviewed By: hanidamlaj, mjoras

Differential Revision: D47135550

fbshipit-source-id: f18f50b91f1575b0d4f4874f52c72fb6a7d5c1e8
2023-07-13 18:39:45 -07:00
Konstantin Tsoy
fe12ab7241 Hide direct timer invocations on the event base into the wrapper
Summary: Needed for future libev-based event base impl.

Reviewed By: hanidamlaj

Differential Revision: D46670916

fbshipit-source-id: 55740ed05da9c1f54cc8639ece89d1f21aaff0d3
2023-07-12 17:26:15 -07:00
Konstantin Tsoy
4a0dd1e2a4 QuicAsyncUDPSocketWrapper
Reviewed By: jbeshay

Differential Revision: D46379200

fbshipit-source-id: f6a7c1cf68108872e05e6fd8adb7f00aae22b2ed
2023-07-11 15:21:15 -07:00
Joseph Beshay
5426bc08a8 Add BBRv2 Congestion Controller
Summary:
This implements the BBRv2 congestion controller for Mvfst. This implementation aims at staying as close as possible to the naming and organization used in the latest draft. Wherever there are gaps in the spec or the pseudocode, this attempts to fill them with reasonable assumptions.

https://datatracker.ietf.org/doc/html/draft-cardwell-iccrg-bbr-congestion-control-02

Besides the spec differences, this implementation differs from Mvfst's BBRv1 as follows. These differences may be revisited in the future:
- The pacing rate is exclusively controlled by the CCA. No further scaling of the pacer rate is enforced. This enables BBRv2 control loop to keep tight control over queueing delay.
- BBRv2 does not rely on an external bandwidth or RTT sampler. Mvfst's BBRv1 decouples these which makes tracking the state a bit harder.

Reviewed By: mjoras

Differential Revision: D44599226

fbshipit-source-id: 1e488bd936db5826b73ff6205f988dd40e908eba
2023-06-22 13:56:23 -07:00
Joseph Beshay
931abc64af Separate transport settings for pacing tick and the pacing timer resolution
Summary:
The pacingTimerTickInterval transport setting conflates two options: the minimum interval a pacer can use, and the resolution of the underlying timer. This means that a higher value leads to lower timer resolution and less pacing accuracy.

This change adds a separate parameter for the timer resolution to ensure that a larger pacing tick does not degrade the pacer accuracy.

Reviewed By: mjoras

Differential Revision: D46564066

fbshipit-source-id: 0d0e54077b80da03e6e6c9baaab49a4c969966b6
2023-06-20 15:18:38 -07:00
Konstantin Tsoy
dccfc706b5 QuicEventBase wrapper
Summary:
Create and use an actual wrapper around folly::EventBase.
Later an interface will be added that the wrapper will be implementing.

Reviewed By: jbeshay

Differential Revision: D45822401

fbshipit-source-id: 3b33f796c31043ec2881b753a9b60943bdf91f1d
2023-06-15 17:12:24 -07:00
Matt Joras
3c5a34ee11 Put opportunistic ACKing behind TransportSetting
Summary:
This has been a default behavior for us for a long time. Basically, we will always include ACK frames in a burst if there's new packets to ACK.

This is overall probably fine and is flexible to peer behavior such that the peer can get away with basically never sending anything ACK-eliciting.

However it is not without its issues. In particular, for DSR it means that we write an excessive amount of pure ACK packets since they cannot be coalesced with a DSR burst.

Make this behavior optional, such that we only include ACK frames in non-probing schedulers when we are only writing stream data.

Reviewed By: kvtsoy

Differential Revision: D39479149

fbshipit-source-id: 6e92d45311a3fb23750c93483b94e97dd3fdce26
2023-06-15 13:15:08 -07:00
Crystal Jin
0fd6ba7f78 Use finalWriteOffset for stream bytes sent
Reviewed By: JunqiWang

Differential Revision: D46663584

fbshipit-source-id: 1b22eb90501a9b904c17818991d01e5a0fbf2734
2023-06-13 08:16:16 -07:00
Joseph Beshay
004c656d3c Adjust minCwnd value for Cubic to respect the one from transport settings
Summary: The minCwnd should not be overwritten by the initCwnd. This affects Cubic minCwnd only. BBR uses its constants directly.

Reviewed By: mjoras

Differential Revision: D46076172

fbshipit-source-id: 63d0be96334e6ca294cdf89bc7545aaa4b960678
2023-05-22 19:25:55 -07:00
Joseph Beshay
a55b14d0f0 Rename QUIC lossbyPto to lossByTimeout to avoid confusion with PTO (probe timeout)
Summary: Classifying loss as `byPto` is confusing because it is not related to Probe Timeouts (PTO). This changes the occurrences of this name in the transport code to `byTimeout`.

Reviewed By: mjoras, kvtsoy

Differential Revision: D45788216

fbshipit-source-id: 9900b928d3f44572a21d6ed7e76be658e21451c7
2023-05-16 12:37:47 -07:00
Matt Joras
e41ea339f8 Don't close via exception on receiving a close.
Summary: This is a dumb shortcut. Just check whether it's happened after reading data and call close that way.

Reviewed By: kvtsoy

Differential Revision: D45205285

fbshipit-source-id: 57edafc50f5e5e9cdaf9ac7e46781b762acd30d8
2023-04-24 13:59:02 -07:00
Paul Farcasanu
e56d4bd7f6 refactor setStreamPriority to accept Priority struct
Summary:
## Context
Context: see summary for D43854603.

## In this diff
In this diff, make way for easily adding new elements to Priority struct.

Reviewed By: afrind

Differential Revision: D43882907

fbshipit-source-id: f74f6ec41162a970dcd666bfa5192676f968d740
2023-03-28 16:00:38 -07:00
Joseph Beshay
24f00aad4a Allow Packet Processors to specify prewrite requests that apply to each write loop
Summary:
Adds a prewrite function in packet processors that can be used to set PreWrite Reuqests that will apply apply to the next write loop in the QuicSocket.

Currently, the PrewriteRequest only contains a list of cmsgs but it can be expanded when needed.

This replaces the setAdditionalCmsgs callback that was previously passed down directly to AsyncUDPSocket, allowing multiple processors to affect the additionalCmsgs sent to the AsyncUDPSocket.

Reviewed By: bschlinker

Differential Revision: D44233700

fbshipit-source-id: 799357ee5df89b2a526611bd83d0b4a9a13b71d5
2023-03-24 16:14:59 -07:00
Hani Damlaj
01b439f2f2 remove QuicConnectionStateBase::logger references
Summary: - purging references to unused variable

Reviewed By: kvtsoy

Differential Revision: D43857376

fbshipit-source-id: bfd721efb21ba966496c0131fb12d2357f620ed4
2023-03-15 15:58:02 -07:00
Crystal Jin
b78833805a Expose stream bytes received in StreamTransportInfo
Reviewed By: hanidamlaj

Differential Revision:
D43921381

Privacy Context Container: L1127813

fbshipit-source-id: f2e659c602e792b27617b75e1eb1f4d9841138f9
2023-03-09 11:09:02 -08:00
Crystal Jin
9dab1046b1 Propagate stream bytes sent up stack for logging
Reviewed By: hanidamlaj

Differential Revision:
D43852121

Privacy Context Container: L1071327

fbshipit-source-id: 7cc94ac52667d1757cb1d0aa150ccbc6562eaf09
2023-03-08 15:39:11 -08:00
Joseph Beshay
58393be7e4 Expose per-write dynamic Cmsgs in QuicTransportBase
Summary: Allow setting the additionalCmsgsFunc in the underlying AsyncUDPSocket

Reviewed By: mjoras, kvtsoy

Differential Revision: D43681325

fbshipit-source-id: 5ebe6c7b81ea2f5f4aa9715deb590736ebd20544
2023-03-07 15:40:46 -08:00
Joseph Beshay
cd5aba8254 Add a transport setting to enable pacing before the 1-RTT keys are available
Summary: As title

Reviewed By: hanidamlaj

Differential Revision: D43773469

fbshipit-source-id: d57ab4de0bea6947e98797d35f84d086f3f900e8
2023-03-03 21:42:10 -08:00
Hani Damlaj
556f56cffd remove .isScheduled() checks
Summary: - both `isScheduled()` and `cancelTimeout()` check if wheel_ != nullptr, no need to check twice

Reviewed By: kvtsoy

Differential Revision: D43582809

fbshipit-source-id: aaf535b227ad3c0da97cfc979b5f8a411d891959
2023-03-03 05:39:57 -08:00
Hani Damlaj
a0e456bc03 migrate folly::none assignment operator to .reset()
Summary: - .reset() is probably fractionally less costly than the assignment operator?

Reviewed By: sharmafb

Differential Revision: D43579041

fbshipit-source-id: 4838b6c21e94197782cf56866950be1dbf65b106
2023-03-03 05:39:57 -08:00
Konstantin Tsoy
aa0fd83223 Implement setStreamGroupRtxPolicy()
Summary: Implement setStreamGroupRtxPolicy()

Reviewed By: mjoras

Differential Revision: D39698378

fbshipit-source-id: c6fc5a9a9ab7f322775565f6df629103b36b2a36
2023-02-23 21:31:24 -08:00
Konstantin Tsoy
b4cb994fd8 Add enableCustomRetransmissionPolicies()
Summary: Add enableCustomRetransmissionPolicies()

Reviewed By: mjoras

Differential Revision: D39658775

fbshipit-source-id: 1413e6a3112e406222df4ce54e6036f518432a82
2023-02-23 21:31:24 -08:00
Konstantin Tsoy
377260f704 Remove d6d code
Summary: we're not using it

Reviewed By: mjoras

Differential Revision: D43482344

fbshipit-source-id: 05ac6792848e32e7c1bcf53a2df172852b5def62
2023-02-23 20:11:24 -08:00
Konstantin Tsoy
b0e3bcea9e Stream groups retransmission policy API
Summary: Stream groups retransmission policy API

Reviewed By: mjoras

Differential Revision: D39405281

fbshipit-source-id: 3edafa8f2c815d72340d5d7a8e8f4cb1fd3996be
2023-02-22 15:02:16 -08:00
Crystal Jin
f2736b33dd Remove stream after onEOM is called but with gate
Reviewed By: mjoras

Differential Revision: D43297002

fbshipit-source-id: 5b2ced42252ddd84f6515efa2581f7cf8b5ac3ca
2023-02-15 13:26:53 -08:00
Crystal Jin
0ac6c66ce3 Back out "Remove stream after onEOM is called"
Summary:
Original commit changeset: ce619be1a2b6

Original Phabricator Diff: D42784838 (fc6ca42bae)

Reviewed By: hanidamlaj, gzxultra

Differential Revision: D43285186

fbshipit-source-id: 66aa33fcd369d00bd9e7fd40b711ef3e54aaca96
2023-02-14 17:35:40 -08:00
Crystal Jin
eedc7d505e Propagate stream loss count up stack for logging
Reviewed By: amirlivneh

Differential Revision:
D42394612

Privacy Context Container: L1071327

fbshipit-source-id: 21e778062c74a5b2830d35d7acdaa4fc66fc052b
2023-02-14 16:43:11 -08:00
Crystal Jin
fc6ca42bae Remove stream after onEOM is called
Summary: This change ensures that the stream is not destroyed before onEOM callback so that onEOM can access stream specific data.

Reviewed By: mjoras

Differential Revision: D42784838

fbshipit-source-id: ce619be1a2b6a542a517a7b4f32c2b3d37aa30fd
2023-02-13 18:46:23 -08:00
Joseph Beshay
4097c5c4c3 Decide whether to send knob frames based upon the transport parameter only and cache it for 0-rtt connections
Summary:
This removes the older method of deciding whether knob frames should be sent using the QuicVersion. With this change, the client can only send knobs when the server has signaled support using the `knob_frames_supported` transport parameter.

To make sure that knobs can be sent in 0-rtt connections, the transport parameter is now included in the client's cache of server transport parameters.

Reviewed By: mjoras

Differential Revision: D43014893

fbshipit-source-id: 204dd43b4551cd1c943153a3716e882fc80e6136
2023-02-07 18:06:27 -08:00
Joseph Beshay
239f2b5b55 Add transport parameter for knob frame support
Summary: Decide if knob frames are supported based upon a transport parameter instead of relying on the QUIC version. This is a cleaner approach, at the cost of an additional transport parameter.

Reviewed By: mjoras

Differential Revision: D42465442

fbshipit-source-id: bfd1d177bdbe198e5eb47e63113410b5738dcede
2023-01-26 12:22:38 -08:00
Konstantin Tsoy
424ab5c8c1 Remove useless func argument
Summary: Remove useless func argument

Reviewed By: jbeshay

Differential Revision: D42647239

fbshipit-source-id: d27b26391971ca31f8bf727e3648d1a0dbf124be
2023-01-24 14:53:27 -08:00
Brandon Schlinker
bddc599e62 ConnectionStartTime in TransportInfo
Summary:
Expose the time when the connection started in `QuicSocket::TransportInfo`.

This is imperfect for `QuicClientTransport` right now, as it marks the time when the transport was created — not the time when the connection was started. This is due to how the underlying value is being populated. Will address in a follow up diff.

Differential Revision: D42224019

fbshipit-source-id: c75dc2df10c252d18225df8508445e99ed5d788a
2023-01-05 15:20:44 -08:00
Matt Joras
1275798146 Make the AckState for Initial/Handshake a unique_ptr
Summary:
We don't need to carry these states after the handshake is confirmed, so make them pointers instead. This will facilitate adding a structure to the AckState for tracking duplicate packets.

(Note: this ignores all push blocking failures!)

Reviewed By: hanidamlaj

Differential Revision: D41626895

fbshipit-source-id: d8ac960b3672b9bb9adaaececa53a1203ec801e0
2022-12-20 11:08:43 -08:00
Brandon Schlinker
eb3009484a Application limited time in packet metadata
Summary:
Track the total (cumulative) amount of time that the connection has been application limited and store this information in `OutstandingPacketMetadata`. If this value is the same for two `OutstandingPacketMetadata` then we know that the transport did not become application limited between when those two packets were sent (or, less likely, the transport was application limited for less than one microsecond given the microsecond resolution of the timestamp).

We store the amount of time spent application limited instead of a count of the number of application limited events because the implications of being application limited are time dependent.

Tests show that we need to be able to inject a mockable clock. That's been an issue for some time; will work on in a subsequent diff.

Differential Revision: D41714879

fbshipit-source-id: 9fd4fe321d85639dc9fb5c2cd51713c481cbeb22
2022-12-08 18:55:22 -08:00
Alan Frindell
c4fbdf7eeb Fix a couple QuicTransportBase bugs
Summary:
1) unregistering a pending write callback from another callback was unsafe.  Follow the paradigm in the rest of this function.
2) Calling closeGracefully() nulls out the connection callback but keeps writing -- need to check that connCb_ is non-null before calling onAppLimited()

Reviewed By: kvtsoy

Differential Revision: D40811191

fbshipit-source-id: fa3512e4aa5ddda3dfc160a044b7d29b7aec8a8a
2022-11-16 18:25:26 -08:00
Hani Damlaj
c22ee0a8ab StopSending Closes Ingress
Summary: - transport settings to enable the following behaviour: invoking stopSending() now drops buffered ingress data and closes the ingress path

Reviewed By: mjoras

Differential Revision: D40678864

fbshipit-source-id: 7dd5c7843909d5ac8cc309292b31d1d87b97a2f5
2022-11-14 18:06:47 -08:00
Hani Damlaj
e1f8e0df1d No-op StopSending If Ingress Closed
Summary: - as title, we should just no-op ::StopSending when ingress is already closed

Reviewed By: jbeshay, mjoras

Differential Revision: D40990383

fbshipit-source-id: e0cd64facf78f510eabe8198e93a643c6ebfb89e
2022-11-04 19:00:24 -07:00
Matt Joras
953235fbc7 Track largest packet acked per DSR stream.
Summary:
The normal loss detection only considers the reordering threshold per packet by comparing it with the largest ACKed packet in the ACK. This is largely based on the fact that QUIC packet numbers are monotonically increasing.

However, when using DSR there is a potential for a different host to be writing the packets to the wire. When there are multiple hosts doing this, there is a degree of reordering that is expected to happen.

Thus we can change the loss detection logic to adjust the largest packet ACKed and use the largest packet ACKed for a given DSR stream when the packet is a DSR packet. This allows for the natural reordering while detecting loss within the DSR sender's timeline of sent packets.

Note that this probably doesn't catch all of the nuances that can happen with the reordering, but it is a good start.

Reviewed By: kvtsoy

Differential Revision: D40647572

fbshipit-source-id: d84c6cd8040fb8c044ddd68fb1abc049ccddfc44
2022-10-27 14:35:11 -07:00
Matt Joras
a65385f001 Control experimental pacing mode with TransportSettings.
Summary: As in title.

Reviewed By: hanidamlaj

Differential Revision: D40742259

fbshipit-source-id: 05e01ab2d9f89f63d06e24d2a74051a927c8b6c9
2022-10-26 20:44:56 -07:00
Matt Joras
3e57e82400 When using ACK_FREQUENCY, disable SRTT/4 heuristic.
Summary: We always use an SRTT/4 ACKing heuristic for the ACK delay. This has generally been a useful heuristic, but when using ACK_FREQUENCY we should defer to using the delay by the peer.

Reviewed By: jbeshay

Differential Revision: D40272530

fbshipit-source-id: c7a44e53233c97d0c96bc6f936a7318cf4676aba
2022-10-11 18:15:24 -07:00
Matt Joras
06aaca5fcd Add transport settings for disabling adaptive loss thresholds for DSR
Summary:
This is useful so we can run experiments that turn this feature off while we turn ACK_FREQUENCY policies on.

(Note: this ignores all push blocking failures!)

Reviewed By: yairgott

Differential Revision: D40148536

fbshipit-source-id: 84aa4a0639b43c8721db0db6885b6af6e1701bdd
2022-10-07 08:45:14 -07:00
Sharad Jaiswal (Eng)
520239e723 Add CongestionController::State to TransportInfo and BW info
Summary: Add a struct with `CongestionController::State` (if available) into `TransportInfo`, and expand the state structure to include the congestion controller's current bandwidth estimate (if available).

Reviewed By: bschlinker, mjoras

Differential Revision: D39413012

fbshipit-source-id: 3eb79cdf53cc37e2cf5e3729cf44557e8a0a3a45
2022-09-29 03:15:09 -07:00