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
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
Summary: Often the pointer can be hard to get back because Clang apparently can't produce DWARF symbols.
Reviewed By: kvtsoy
Differential Revision: D39787495
fbshipit-source-id: 81596f35843200e90d4786a70837cdf75cfc9cac
Summary: Ensure stream is not null when the transport is getting it from the StreamManager
Reviewed By: mjoras
Differential Revision: D39753796
fbshipit-source-id: bc2a870a26510267d972bb59758792696c99501d
Summary: This makes the unsetting of the DSR sender explicit. By doing this we can guarantee that a sender, if it has a dependency of the transaction lifetime, will be released before the transaction itself.
Reviewed By: kvtsoy
Differential Revision: D39525914
fbshipit-source-id: 6f0094b1ad1970ed603032469aede9ca1ed9c255
Summary:
The current `close` observer event marks when `closeImpl` is called. However, the actual close of the socket may be delayed for some time while the socket drains. I've changed the existing event to `closeStarted` and added a new event `closing` that marks the close of the underlying `AsyncUDPSocket`.
Adding the `closeStarted` event required two other changes which are difficult to separate from this diff:
- When a transport is destroyed, `QuicTransportBase` was calling `closeImpl` and also closing the UDP socket. However, because the `folly::ObserverContainer` used to store observers is maintained in classes that derive from `QuicTransportBase`, the observers are gone by the time the UDP socket is closed in the base class destructor. Thus, the UDP socket should be closed by the derived classes in their respective destructors. This requirement is inline with the existing code: `closeImpl` is called by all derived classes in their destructors. Made this change and added `DCHECK` statements in the `QuicTransportBase` destructor to ensure that derived classes cleanup after themselves.
- Writing tests with draining enabled and disabled required being able to set the transport settings. However, all of the existing `QuicTypedTransportTest` test cases were designed to operate after the connection was accepted (for the server impls) or established (for client impls), and transport settings cannot be updated at this state. Resolving this required adding new test classes in which the accept/connect operation is delayed until requested by the test.
Reviewed By: mjoras
Differential Revision: D39249604
fbshipit-source-id: 0ebf8b719c4d3b01d4f9509cf2b9a4fc72c2e737
Summary: - adding an API to the QuicSocket to enable users to synchronously query the socket for the maximum amount of data that should be written.
Reviewed By: mjoras
Differential Revision: D37390086
fbshipit-source-id: 5dd64e28b7f841ba3e28a4bc2a79c1b1e5a95047
Summary: PacketProcessors process the packets that we send and their corresponding ack and loss events. We store a vector of packet processors inside `QuicConnectionStateBase` and we call `onPacketSent` and `onPacketAck` whenever their corresponding functions in `CongestionController` class are called. The plan is to make `CongestionController` class extend `PacketProcessor`.
Reviewed By: bschlinker
Differential Revision: D36404668
fbshipit-source-id: 52d63a6a74bfa2031131d31047da25a5e2be12aa
Summary: When there are multiple different DSR senders, there can be a large degree of reordering present. We can partially mitigate this for now by using adaptive reordering thresholds all the time when DSR is on.
Reviewed By: shodoco
Differential Revision: D37400821
fbshipit-source-id: f456e447fd58154d26bd642c22e71457e0d27b7c
Summary: Implement group streams receiver api in transport
Reviewed By: mjoras
Differential Revision: D36419901
fbshipit-source-id: 98bfefa1a4205fde8764f2e4300f51156667e024
Summary: Implement group streams api in transport
Reviewed By: mjoras
Differential Revision: D36417214
fbshipit-source-id: dee93807fe061f2abd9c779da9a2cd1df1865c3e
Summary: Deferring it to the next read causes a bunch of data to go out of cache, which guarantees a cache miss when we try to clear it. Instead, clear it immediately after the callbacks.
Reviewed By: bschlinker
Differential Revision: D36151205
fbshipit-source-id: 467a45e2ef901b5705fb3db38d2648ba97784c8d
Summary:
This diff is part of larger change to switch to using `folly::ObserverContainer` (introduced in D27062840).
This diff:
- Changes `LegacyObserver` to inherit from the new `Observer` class by adding a compatibility layer. This compatibility layer enables existing observers to continue to be supported.
- Changes generation of observer events so that they are routed through `ObserverContainer::invokeInterfaceMethod`
- Temporarily removes some of the reentrancy protection that previously existed, as it was not being applied consistently — some events had reentrancy protection, some did not. This will be reintroduced in the next diff.
- Improves some unit tests for observers during the transition process.
Differential Revision: D35268271
fbshipit-source-id: 5731c8a9aa8da8a2da1dd23d093e5f2e1a692653
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
Summary:
This diff is part of larger change to switch to using `folly::ObserverContainer` (introduced in D27062840).
This diff:
- Renames `quic::Observer` to `quic::LegacyObserver`.
- Switches to using `quic::SocketObserverInterface` instead of `quic::Observer` when referencing structures used for the observer interface. For instance, `quic::Observer::WriteEvent` changes to `quic::SocketObserverInterface::WriteEvent`.
Differential Revision: D35000152
fbshipit-source-id: f387231fd58e8e763c3d7ed0a9c6fcec3b2324e2
Summary:
Check `CloseState` to ensure the socket open when determining a socket is good.
`QuicSocket::good` notes that a socket is good iff the transport is open and ready.
Reviewed By: bschlinker
Differential Revision: D35661700
fbshipit-source-id: 46d4cf3ae57bd79c0efbea0d03dab7a92a43f33b
Summary: Make `min(minRTT - ACK delay)` obsered so far over the life of the connection available in `TransportInfo`. In addition, expose the last RTT and last RTT's AckDelay value as well.
Reviewed By: mjoras
Differential Revision: D28385923
fbshipit-source-id: a58000ac8bd9fdc63caa0b636bdb83905cd6b448
Summary: Trigger `PacketsWrittenEvent` even if no congestion controller is installed. We previously had it require a congestion controller because it was related to the app limited event.
Differential Revision: D34541746
fbshipit-source-id: 3dc0930cbbc8b190fb63c31dffb76c8274c8e9d3
Summary: Extend `PacketsWrittenEvent` to include the CWND and number of writable bytes from the congestion controller after the write completed. If no congestion controller is installed, these values are left blank.
Differential Revision: D32588533
fbshipit-source-id: 4b8361937fcab36daa17e5f6dc4386762987d2b4
Summary: Report all bytes written in observer packets written events.
Reviewed By: jbeshay
Differential Revision: D33086404
fbshipit-source-id: 1456cf23a420abd025f047f190cb2b8a9868826e
Summary:
This is an experiment to improve BBR's performance with bursty traffic when a traffic shaper is present in the path. The change is fully contained within BbrTesting.
Currently, with every new request, BBR generates a high bandwidth estimate from the shaper's burst that is not valid once's the shaper's burst has expired. This causes BBR to introduce unnecessary queuing delay until the bandwidth estimate has reacted to the shaper's rate. When the requests are small enough and are separated by an interval of inactivity, this behavior repeats with every request causing bursts of queueing delay.
This change attempts to detect the presence of certain common shaper configurations. If the presence of a shaper is detected with sufficient confidence, the shaper's rate is used to limit the bandwidth estimate of BBR.
Reviewed By: bschlinker
Differential Revision: D34483728
fbshipit-source-id: 7d27b1383b01381140aa7cae340889fb49cb5a5e
Summary:
- Enable starting BBR with an initial cwnd and minrtt guesses.
- Add minrtt to QuicConnectionStats
- Add unit test for new BBR constructor
Reviewed By: mjoras
Differential Revision: D34438518
fbshipit-source-id: 58607cd3b1424a3f1f006dee94f910a29103826b
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
Summary:
Add a helper function to set default error code for close() and
closeNow()
Reviewed By: mjoras
Differential Revision: D34191863
fbshipit-source-id: 8f818f471307ea64ed046ec5e93852566247faa3
Summary: Add new connection end cb option to client/server transport
Reviewed By: mjoras
Differential Revision: D34190871
fbshipit-source-id: 375cf95bc8dbe4ab759140cfb4b33b732869953f
Summary: In order to provide more information about datagrams when we receive them, I'm adding a wrapper around the BufQueue that we currently hold so we can include receiveTimePoint and any other metadata we might want to expose for the Datagram API.
Reviewed By: mjoras
Differential Revision: D33994358
fbshipit-source-id: 805f182cd350908320639bc07eb6f3b7349bbc05
Summary:
BBRv2 draft has two different types of bandwidth samples to be used in different situations. A long-term estimate that is used while probing, and a short-term estimate that is more sensitive to congestion signals.
This change adds a new congestion controller (bbr_testing) that attempts a simpler version of the BBRv2 suggestion on top of the existing BBR implementation. In bbr_testing, if the connection is draining or cruising (pacing_gain=1), the latest bandwidth sample will be used by BBR instead of one from the max filter.
Theoretically, this allows BBR to still achieve a good estimate when probing for available bandwidth, while avoiding unnecessary queueing if the bandwidth changes while cruising. This should reduce queueing on links that have a shaper with bursts.
This can be used in `hq` as follows:
```
./hq --mode server --host "::" -congestion=bbr_testing -pacing=1
```
Reviewed By: bschlinker
Differential Revision: D33344876
fbshipit-source-id: 32ef9ecacc7a7692cb1e4bd59284bc1adadd35b5
Summary:
Adds a transport callback for ping received.
Uses the callback in the HTTP3 session to reset the timeout
Also now invokes the ping callbacks synchronously to avoid issues during connection shutdown
Reviewed By: mjoras
Differential Revision: D33753068
fbshipit-source-id: 99ac14d0e4b9539f3a20c5c55bb5241351bf1c57
Summary:
Adds a transport callback for ping received.
Uses the callback in the HTTP3 session to reset the timeout
Reviewed By: mjoras
Differential Revision: D33101180
fbshipit-source-id: d6fcecd22cbd5c311674dd9421c0c54eb04728a0
Summary: `mrtt` in `TransportInfo` currently defaults to max val if it has not been measured yet (start of connection, end of connection that never had any ACKs, etc.). Downstream consumers may not realize this, which leads to a mess. Changes it into an optional.
Reviewed By: mjoras
Differential Revision: D28383235
fbshipit-source-id: 0f103dd880e96ba60b08e0834c4ecbab81dc4221
Summary:
Providers observers with insight into ACKs received. Works for both client and server transport.
Attempts to prevent wasted memory by removing any allocated memory for ACK events if no packets in flight. In tandem, reduces allocs by _not_ removing allocated memory when packets are in flight (as this means more ACK events will occur soon...).
Reviewed By: jbeshay
Differential Revision: D31221280
fbshipit-source-id: 64b73aa74c757ebbfc27bb9c2a047d08dc7a77ca
Summary:
Currently the `packetsWritten` observer event is only triggered when ACK-eliciting packets are written to the network. This change makes it so that the event is triggered even when non ACK-eliciting packets are written. In addition, this change increases the information provided in the observer event to reduce the processing that must be performed by observers.
More specifically, this diff makes the following changes:
- It creates two new structs — `WriteEvent` and `PacketsWrittenEvent` — and makes `PacketsWrittenEvent` and `AppLimitedEvent` inherit from `WriteEvent`, which contains the base set of fields that appear in both derived events. The base set of fields includes `writeCount` and the reference to the list of `OutstandingPackets`.
- A `PacketsWrittenEvent` is generated after each write loop during which packets are written.
- The `PacketsWrittenEvent` records the total number of packets written (the sum of ACK-eliciting and non ACK-eliciting packets written) and the total number of ACK-eliciting packets written during the last loop. By exposing this information, observers can determine whether there is value in inspecting the list of `OutstandingPackets` before doing so.
- In the future, I'll extend this event to also report the number of stream bytes written.
- It adopts a new builder pattern for observer events to make it easier to create instances of these structures:
- We use this approach instead of aggregate initialization (specifically designated initializers via aggregate initialization), because designated initializers (C++20 feature, although supported by some compilers long before) is not yet supported on all platforms for which we need this code to compile.
- I intend to change the other observer events to use this pattern as the number of arguments in some of their constructors makes them increasingly difficult to deal with.
Reviewed By: mjoras
Differential Revision: D31216724
fbshipit-source-id: 42ceb922d46ab0e0dc356f8726c2d0467a219587
Summary: Provide observers with visibility into stream events triggered by local and peer (e.g., new stream opened locally or by peer).
Reviewed By: mjoras
Differential Revision: D31886978
fbshipit-source-id: 7556fef0f336bd0f190b4474f1a7b0120aae6ef1
Summary: As titled. We currently allow `QuicSocket::Observer::close` to be called multiple times. Only call it once.
Reviewed By: lnicco
Differential Revision: D31886995
fbshipit-source-id: 61d959e8575b08c34ef896b87da0cf8ada482144