1
0
mirror of https://github.com/facebookincubator/mvfst.git synced 2025-11-25 15:43:13 +03:00
Commit Graph

108 Commits

Author SHA1 Message Date
Brandon Schlinker
f20eb76865 Use folly::ObserverContainer for socket observer [3/x]
Summary:
This diff is part of larger change to switch to using `folly::ObserverContainer` (introduced in D27062840).

This diff:
- Adds methods to `QuicSocket` to support adding and removing `ObserverContainer` observers. By default, `QuicSocket` implementations will not support observers as `QuicSocket::getSocketObserverContainer` returns `nullptr`, and this will cause `QuicSocket::addObserver` and `QuicSocket::removeObserver` to fail gracefully.
- Adds support in `QuicClientTransport` and `QuicServerTransport` for `ObserverContainer` observers by overriding `getSocketObserverContainer`. Each implementation creates an `ObserverContainer` on construction that is destroyed on destruction.
- Adds the `close` event to the new observer interface and adds corresponding support in `QuicTransportBase`. This allows both the old and new observers to receive the close event. The next diff will do a hard cutover of the rest of the events.

Differential Revision: D35000960

fbshipit-source-id: e75807c97f4385532bf36244591a259aa0a2f4cc
2022-04-18 04:19:31 -07:00
Hani Damlaj
c8bf098e5d Change Implementation of WritableBytesLimit
Summary: - updating usage of WritableBytesLimit

Reviewed By: mjoras

Differential Revision: D33079816

fbshipit-source-id: 1854f40a7b00526afb2167764aeddf55edb1771f
2022-04-04 16:18:52 -07:00
Hani Damlaj
94cda41d85 FullHandshakeDone Callback
Summary:
```
buck test //quic/server/test:QuicServerTransportTest
```

Reviewed By: mjoras

Differential Revision: D34696930

fbshipit-source-id: df563fc00773df7acb9bea0bb02d26e99c1fb02f
2022-03-11 13:13:00 -08:00
Matt Joras
f0bab29cb3 Add ability for server to export 1RTT cipher.
Summary: As in title.

Reviewed By: jbeshay

Differential Revision: D31513079

fbshipit-source-id: add12857a66cedd4f0dbd071661f0885d462ffa2
2022-03-01 17:46:52 -08:00
Matt Joras
360c211738 Keepalive timer support
Summary:
This implements a basic keepalive timer at the transport layer.

The basic idea is to leverage the same conditions as the idle timer. The keepalive timer will fire ~15% before the idle timer and trigger a PING frame. This has the effect of keeping the connection open if the PING is acknowledged.

Reviewed By: jbeshay

Differential Revision: D34256174

fbshipit-source-id: a8cee579f5b09bdfa23bcdc7cf4c70de299de3bd
2022-02-24 12:40:01 -08:00
Konstantin Tsoy
a70ffbeb29 Rename ConnectionCallbackNew back to ConnectionCallback
Summary: Rename ConnectionCallbackNew back to ConnectionCallback

Reviewed By: mjoras

Differential Revision: D33979956

fbshipit-source-id: 6c133a406c4bf6799838ffc36701267a938cb4a3
2022-02-23 12:57:31 -08:00
Joseph Beshay
30423c75c6 Consolidate transport knob definitions into QuicConstants
Summary: The two lists of transport knobs in two different locations keep getting out of sync. This consolidates them into one location which is QuicConstants.

Reviewed By: mjoras

Differential Revision: D34227259

fbshipit-source-id: 26b20620f4ef85f8887e7294512155060a057839
2022-02-22 17:27:47 -08:00
Konstantin Tsoy
2e468b5e5d Add new connection end cb option to client/server transport
Summary: Add new connection end cb option to client/server transport

Reviewed By: mjoras

Differential Revision: D34190871

fbshipit-source-id: 375cf95bc8dbe4ab759140cfb4b33b732869953f
2022-02-22 14:24:23 -08:00
Konstantin Tsoy
54ce32396c get rid of callbacks indirection layer
Summary: get rid of callbacks indirection layer

Reviewed By: mjoras

Differential Revision: D34189595

fbshipit-source-id: e4a0aba768b17054f06091c12ef66f1a8019885f
2022-02-15 11:45:09 -08:00
Konstantin Tsoy
cecc1ba279 Introduce QuicError struct
Summary: Instead of using std::pair everywhere

Reviewed By: mjoras

Differential Revision: D34146686

fbshipit-source-id: dfe48f43775de868aba06a5b9b5a004e5793bdbb
2022-02-14 16:00:21 -08:00
Joseph Beshay
1234cfc6ac Add experimental config for the pacer to use an adjustable burst
Summary:
Add an experimental setting in the TokenlessPacer to use an adjustable burstSize in the to compensate for delays in pacer loop timer with a limit of 5 loop intervals.

This practically restores some concept of tokens in the pacer. This should help with pacer timer delays observed in relatively high BDP links.

To help quantify how often the delays happen, the QuicStats pacer_lagged counter is updated every time the pacer is delayed by more than 10% when the connection is not application limited.

In a test configuration across a 150 Mbps link with 150 ms round-trip delay, the experimental setting achieves ~25% higher bandwidth.

Reviewed By: bschlinker, mjoras

Differential Revision: D33035430

fbshipit-source-id: 4aa02821d609facf6c830647459319d44c6fc3bd
2022-02-11 12:36:54 -08:00
Konstantin Tsoy
dc79176a56 Deprecate old connection callback
Summary: Deprecate old connection callback

Reviewed By: jbeshay, lnicco

Differential Revision: D33695440

fbshipit-source-id: 043baa53b71453b5e2b9f60d890f1adcda7c65b5
2022-02-02 19:03:57 -08:00
Konstantin Tsoy
1ca4c4e66c Move tests to split callbacks
Summary:
Maine change is `MockConnectionCallback` -> `MockConnectionSetupCallback` + `MockConnectionCallbackNew`.
Everything else is changing tests to use the two new classes.

Differential Revision: D33076321

fbshipit-source-id: a938b63ce59f07f549b3e725caad8785348db7ed
2022-02-02 14:03:23 -08:00
Hani Damlaj
00e67c1bf9 mvfst License Header Update
Reviewed By: lnicco

Differential Revision: D33587012

fbshipit-source-id: 972eb440f0156c9c04aa6e8787561b18295c1a97
2022-01-18 13:56:12 -08:00
Hani Damlaj
2660a288b3 Update Company Name
Summary: - as title

Reviewed By: lnicco

Differential Revision: D33513410

fbshipit-source-id: 282b6f512cf83b9abb7990402661135b658f7bd1
2022-01-13 12:07:48 -08:00
Joseph Beshay
688d0ed31e Use adaptive thresholds for loss-detection through reordering and timeout
Summary:
Experiment with using adaptive thresholds for detecting packet losses through reordering or timeouts. When transportSettings.useAdaptiveLossThresholds is set to true, every time a spurious loss is detected, the thresholds will be updated to avoid marking similar packets as losses. In cases with a high degree of packet reordering, this improves bandwidth utilization significantly.

The useAdaptiveLossThresholds setting can be set using a new transport knob.

This was verified by transferring a 5 MB object across 50 Mbps link with high random packet reordering (emulated using netem)
```
+ tc -s qdisc replace dev veth7 root handle 1:0 netem rate 50Mbit limit 1250
+ tc -s qdisc add dev veth7 parent 1:0 handle 2: netem delay 15ms 5ms distribution normal limit 1250
```

Without adaptive thresholds, ~43% of sent bytes are retransmissions. Goodput is 2 Mbps.
With adaptive thresholds, ~3% of sent bytes are retransmissions. Goodput is ~17.5 Mbps.

Reviewed By: mjoras

Differential Revision: D33354584

fbshipit-source-id: 390bfb3398d499fcdf97a5cfd5654da3eeabed17
2022-01-07 18:42:12 -08:00
Kyle Mirzakhanian
29ed688b58 Add padding to QUIC short header packets
Summary:
Adds paddingModulo to QuicPacketBuilder, which pads up short header packets so that the length remaining of a packet is a multiple of paddingModulo

ie a message of length 25 and max packet size of 40 with a paddingModulo of 8 will get 7 padding frames to a total length of 32. (and a message of length 26 will get 6 padding frames to also go up to a total length of 32)

Reviewed By: mjoras

Differential Revision: D32858254

fbshipit-source-id: 99ada01108429db9f9bba1e342daf99e80385179
2022-01-07 15:02:05 -08:00
Hani Damlaj
f60c254c49 Log Server Handshake Size
Summary: - logging number of bytes the server sent during the handshake for insight.

Reviewed By: mjoras

Differential Revision: D33069800

fbshipit-source-id: e7e8f25183ee30de99e2971bae3c6b93882f6e63
2022-01-06 10:34:06 -08:00
Joseph Beshay
cae8a1b705 Add experimental config for CUBIC with better Hystart limits
Summary:
Add experimental CUBIC's hystart delay bounds that ensure CUBIC does exit Hystart too early. Current limits of 2,8 us are too short.

On a 100 Mbps link with 150 ms round-trip delay, this improved CUBIC's throughput from ~14 Mbps to ~80 Mbps.

Reviewed By: mjoras

Differential Revision: D33035403

fbshipit-source-id: bdeb081111f8053bc7fb01002316d991d8bac2e0
2021-12-16 08:42:01 -08:00
Matt Joras
e784fafb10 Global limit on unfinished handshakes.
Summary:
This implements a global (per process) limit on unfinished handshakes from unverified source addresses.

This limits the ability of an attacker to create connection state without also allocating connection state themselves. By default the limit is 1024.

Reviewed By: kvtsoy

Differential Revision: D32772165

fbshipit-source-id: 6c195169377a9f687c54bc9782cc58fe085e1275
2021-12-09 12:55:33 -08:00
Matt Joras
6afecccd25 Track loop limit time across functions.
Summary: Otherwise we can end up in a situation where the non-DSR scheduler was limited by the loop time while the DSR scheduler is not, leading to an inconsistency.

Reviewed By: lnicco

Differential Revision: D32570027

fbshipit-source-id: f43d2517589c22bac0f2bb76626cc55c2a21fa5d
2021-11-19 19:04:37 -08:00
Joseph Beshay
fb274d273e Add Transport Knob for controlling Auto Background Mode on a QUIC transport
Summary:
- Change the knob param handler to receive a Transport rather than a ConnectionState.
- Add a new transport knob that can set the priority threshold and target utilization factor for automatically controlling background mode based upon active streams.

Reviewed By: mjoras

Differential Revision: D31847477

fbshipit-source-id: 4cfeff04b9fe60eb25ab484f460e252ef6970646
2021-10-25 12:09:16 -07:00
Joseph Beshay
65bc8cf2c4 Add experimental background transport mode to BBR
Summary:
Experiment with a less aggressive variant of BBR that could be used for background requests in order to improve responsiveness of foreground requests.

BBR's agressiveness can be controlled through a new transport knob CC_AGRESSIVENESS_KNOB(0xccab) which accepts values between 25-100. The value indicates the percentage of the available BW the congestion controller should try to use, leaving headroom for other flows.

Aggressiveness of BBR is reduced by adjusting BBR's startup gain during the STARTUP phase. During the ProbeBW phase, BBR uses a longer pacing gain progression with values that intentionally underutilize the available BW.

Reviewed By: bschlinker, mjoras

Differential Revision: D31219364

fbshipit-source-id: c67ffcf03d27fd4d41be2d58f00f4f960c7646c7
2021-10-14 10:41:13 -07:00
Konstantin Tsoy
41be39b61b Introduce split callbacks
Summary:
This diff introduces split callbacks to QUIC.
Old: callback:
* `ConnectionCallback`
Two new callbacks:
* `ConnectionSetupCallback`
* `ConnectionStreamsCallback`

For now the idea is that both old and new callbacks will live side by side and mvfst will decide which callbacks scheme to use via the `useSplitConnectionCallbacks` flag supplied on both QUIC client and server creation.

Reviewed By: mjoras

Differential Revision: D30407129

fbshipit-source-id: 7b726c2652ebe00b47f44bf291cffb9d9f6c884b
2021-09-11 17:38:51 -07:00
Matt Joras
e8ad5a7d06 Remove DSR enabled transport setting.
Summary: As in title. This isn't actually very risky to have on, and is actually confusing if you try to use the APIs without the flag since nothing will happen.

Reviewed By: shodoco

Differential Revision: D30585491

fbshipit-source-id: d79598ab5c723675d63cb71f011b9107acda6d7d
2021-09-03 11:25:37 -07:00
Konstantin Tsoy
21ea1990ab Add a useSplitConnectionCallbacks to mvfst
Summary:
This change just adds a (currently no-op) flag that will be used in diffs up the stack.

The idea here is that I'll add split QUIC connection callback interfaces that will live side by side with existing single monolithic callback for now. We will experiment with split callbacks on small scale to see that there is no regressions and then will phase out the old callback gradually.

This flag is to control which callback(s) to use.

Reviewed By: mjoras

Differential Revision: D30399667

fbshipit-source-id: 8fc4e4a005e93cf6d48a987f49edee33b90dbbf1
2021-08-31 18:27:40 -07:00
Konstantin Tsoy
ee59ae43c6 resetConnectionCallbacks() util function
Summary: In preparation for split callbacks

Reviewed By: mjoras, lnicco

Differential Revision: D30398849

fbshipit-source-id: 684c289283d0b06b5935fc1b8ab2dcbd126ec0ce
2021-08-25 16:15:42 -07:00
Joseph Beshay
5e2f5719b7 Remove all remaining references to QuicVersion::MVFST_D24
Summary:
- Remove QuicVersion::MVFST_D24 (3625d9e7af) constant
- Remove all references in QUIC code
- Remove external references
- Change Liger defaults that referred to the removed constant value

Reviewed By: mjoras

Differential Revision: D29767833

fbshipit-source-id: 980b3c4a7f190442577c3dede14127e77ce472fa
2021-07-20 13:31:10 -07:00
Matt Joras
003f012cb7 TODO comment cleanup.
Summary:
These are either no longer relevant, are unlikely to be done, or are spculative enough that they don't deserve code space.

Hope here is to make our search for TODOs higher signal.

Reviewed By: lnicco

Differential Revision: D29769792

fbshipit-source-id: 7cfa62cdc15e72d8b7b0cd5dbb5913ea3ca3dc5a
2021-07-20 10:27:32 -07:00
Joseph Beshay
9e2ba784e0 Add transport knob to control MAX_PACING_RATE
Summary: Add a new transport knob (MAX_PACING_RATE_KNOB) to allow the client to suggest a limit on the pacing rate used by the server, if it has pacing enabled.

Reviewed By: mjoras

Differential Revision: D29335469

fbshipit-source-id: 8f0a881e8235e0d787ea86ba1e268a36eecf6151
2021-07-07 18:26:56 -07:00
Matt Joras
bb4dec79ac Bail if we are missing either CID.
Summary:
This function actually assumes both are there. This mostly happens in unit tests anyway.

(Note: this ignores all push blocking failures!)

Reviewed By: yangchi

Differential Revision: D29187689

fbshipit-source-id: a7ca516c18de4f0261ffec985f1d4e9f63b071d9
2021-06-17 19:57:43 -07:00
Udip Pant
1241731b18 reduce log spam in QuicServerTransport
Summary: Reduced the log level on transport knob updates to avoid excessive logs

Reviewed By: lnicco

Differential Revision: D29151246

fbshipit-source-id: f718792736c1aa7e03511c409912b58a981c2c64
2021-06-16 13:10:35 -07:00
Joseph Beshay
38440d787c Add transport knob for totalBufferSpaceAvailable to test an equivalent of TCP's NOTSENT_LOWAT
Summary:
Add a new transport knob `NOTSENT_BUFFER_SIZE_KNOB` that will allow us to run quick experiments for different buffer sizes on the server side.

## Background
In TCP, the send buffer accounts for both the unacked and unsent data. SO_SNDBUF is the sum of both and is statically configured for the socket. TCP_NOTSENT_LOWAT only limits the unsent data which still allows the SO_SNDBUF to still accommodate a big BDP.

In mvfst, the buffer usage we currently track (sumCurStreamBufferLen) is only for unsent data. Its size is controlled by the TransportSetting totalBufferSpaceAvailable. Unacked packets are tracked as outstanding packets and do not count toward that buffer space. Effectively, a limit on this buffer achieves the same effect as TCP's NOTSENT_LOWAT socket option.

Reviewed By: mjoras, yangchi

Differential Revision: D28843244

fbshipit-source-id: 3b61619038f3b41508fe76c2873e41486ae97739
2021-06-03 17:37:43 -07:00
Frank Cangialosi
d5177fd458 add new transport knobs: cc type and rtt factor
Summary:
add 3 new transport knobs:
1. set congestion control algorithm (string algorithm name)
2. set pacing rtt factor to be used during "startup" phase of congestion control, right now only used by bbr and copa
3. set pacing rtt factor to be used by default during congestion control, right now only used by bbr and copa

Reviewed By: yangchi

Differential Revision: D28462540

fbshipit-source-id: 2c861885e472cb2bce0b51daeef2b143e9628080
2021-05-18 17:57:55 -07:00
Yang Chi
f5fbaeb5e8 Move QUIC DSR Scheduler, PacketBuilder, WriteCodec and WriteFunctions to
Summary: make space for backend subdir

Reviewed By: mjoras

Differential Revision: D27999777

fbshipit-source-id: 1d270b8ce3349980a1e4c68035a1f39c095237b5
2021-05-10 16:55:12 -07:00
Yang Chi
38c903ba2f Remove all QUIC_TRACEs
Summary: no longer used

Reviewed By: lnicco

Differential Revision: D28141008

fbshipit-source-id: 870d6574cc1657914a08f1ef5ee581cfef96aad1
2021-05-10 12:46:08 -07:00
Yang Chi
047c654d05 Put QUIC packetization requests writing behind a TransportSettings flag
Summary: disable by default

Reviewed By: mjoras

Differential Revision: D27896833

fbshipit-source-id: 4a16e9661abb5f211972426d5c70b6a479fb969d
2021-05-04 18:38:59 -07:00
Yang Chi
cdacec015a QuicServerTransport write DSR packetization requests
Summary:
This diff hooks the DSR write function into QuicServerTransport's
write path.

Reviewed By: mjoras

Differential Revision: D27890711

fbshipit-source-id: ac4452373c0baafe091f93fb54fccf87be604a9c
2021-05-04 01:08:16 -07:00
Yang Chi
a16f502393 Adding control of the starting packet number in a server connection
Summary: as title, this is a testing only API

Reviewed By: mjoras

Differential Revision: D27746039

fbshipit-source-id: cf87836810a4579f622152ccb17aca49a0d605e3
2021-04-27 13:57:51 -07:00
Yang Chi
cc4f57811d Custom crypto factory
Summary:
as title. This also moves a FizzCryptoTestFactory from FizzCryptoFactoryTest to TestUtils so that it can be used in other test code

This change has an unfortunate side-effect that cryptoFactory_ in both client and server will be moved from stack to heap.

Reviewed By: mjoras

Differential Revision: D27264488

fbshipit-source-id: febc307fb02cb136d58fe70bee648d35431acff0
2021-04-27 13:57:51 -07:00
Matt Joras
d4df9b9ef9 Don't vary server packet length based on v4/v6.
Summary: This seems to cause some issues with CGNAT type networks where the client is actually using v6 or v4.

Reviewed By: yangchi

Differential Revision: D27772485

fbshipit-source-id: ac118441caad38301f2a22e657cefb398a5210da
2021-04-14 18:10:52 -07:00
Matt Joras
55e0fa070e Send probes on all spaces take 2.
Summary:
As before we will now aggressively send probes on all spaces with probes available when the PTO timer fires.

This time with more unit tests and some bug fixes.

Reviewed By: yangchi

Differential Revision: D27338523

fbshipit-source-id: 8a9ccb90ed691e996fab4afa2f132c0f99044fbc
2021-04-02 14:59:57 -07:00
Matt Joras
a92a24bdd5 Back out "Send probes for all spaces."
Summary: As in title. There's a bug here somewhere with empty write loops we need to find.

Reviewed By: yangchi

Differential Revision: D27279100

fbshipit-source-id: e1d26fbf8d6df1590d464a6504a8b940b46794e0
2021-03-23 16:10:12 -07:00
Matt Joras
bceb00346b Send probes for all spaces.
Summary:
Previously we would only send probes for the first space which had one available, i.e. Initial before Handshake before AppData. Since we only have one PTO timer this can lead to situations where we perpetually probe with only Initials, which can significantly delay the handshake if we should have probed with Handshakes.

With this diff we will keep the single PTO timer but aggressively write more probes from all spaces if they are available.

Additionally this refactors some counters into EnumArrays

Reviewed By: yangchi

Differential Revision: D27235199

fbshipit-source-id: ef3614a833bf0f02f5806846a1335fa7ac2a4dc8
2021-03-23 12:51:36 -07:00
Andrii Vasylevskyi
10a6feed49 Reset congestion controller after setting factory
Summary:
Before the change, there's no good way to recreate Cubic CC instance with custom CC factory, because Cubic is created by default.

On client side this requires calling setCongestionControl() or setTransportSettings() after calling setCongestionControllerFactory(), which is normally the case.

Reviewed By: yangchi

Differential Revision: D26401996

fbshipit-source-id: dfda39be835c67b9db42f726b3ac64c7b3d37c2f
2021-02-19 17:55:10 -08:00
Andrii Vasylevskyi
b1a364b9dd QuicConnectionStats type change from string to the "native"
Reviewed By: lnicco

Differential Revision: D26379617

fbshipit-source-id: 308d53ca86c2a2e774e3618038eece7091482ed8
2021-02-19 10:47:02 -08:00
Andrii Vasylevskyi
ba71671bb2 QuicConnectionStats for client socket
Summary: Adding QuiConnectionStats to client transport. Moving getConnectionsStats() logic from server worker into transport base class.

Reviewed By: lnicco

Differential Revision: D26316635

fbshipit-source-id: a384eee5d1bc7b23d908e0b03fafcc4ee962b0b9
2021-02-19 10:47:02 -08:00
Sridhar Srinivasan
bd1ed4b7c0 Make the important Observer callbacks configurable
Summary:
Given the large number of callbacks that are being triggered from the Observer
this change makes it possible to enable through a simple config, just the
subset of callbacks that a consumer is interested in receiving.

Observer and Socket Lifecycle callbacks are enabled by default, they are not
configurable.

Reviewed By: bschlinker

Differential Revision: D25879382

fbshipit-source-id: abe79ed92e958ddc96475c347f8ec7204400cdfa
2021-01-13 15:35:06 -08:00
Sridhar Srinivasan
27fe474171 Migrate the QUIC and TransportMonitor libraries to use the new unified Observer callback class
Summary:
We were using the LifecycleObserver and InstrumentationObserver classes
separately, to generate and receive callbacks.

This change migrates both these to use the unified Observer callback class and
adjusts the unit tests.

Reviewed By: bschlinker

Differential Revision: D25845845

fbshipit-source-id: c489400f5d70bccadbcc1d957136c5ade36b65ff
2021-01-13 15:35:06 -08:00
Yang Chi
711f03dc91 Keep stats of unfinished handshake in Quic server transport
Summary: as title

Reviewed By: avasylev

Differential Revision: D25674498

fbshipit-source-id: d0ac116462bf5f95ee67f5f2c5510e7a1701f2fd
2020-12-22 12:13:07 -08:00