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

18 Commits

Author SHA1 Message Date
Aman Sharma
303c405e10 Create IOBuf on the stack using folly::IOBuf::wrapBufferAsValue for body
Summary: This is similar to the previous commit. We use a stack-based IOBuf instead of allocating one on the heap. This saves CPU because allocations/deallocations on the stack are a lot cheaper.

Reviewed By: hanidamlaj

Differential Revision: D53101722

fbshipit-source-id: dd59a7eca6498db19472a62f954db3e2f2f27a42
2024-01-29 15:19:12 -08:00
Aman Sharma
b2db063139 Create IOBuf on the stack using folly::IOBuf::wrapBufferAsValue for headers
Summary: Creating an IOBuf on the heap when we use `folly::IOBuf::wrapBuffer` is expensive.

Reviewed By: hanidamlaj

Differential Revision: D52506216

fbshipit-source-id: eed2b77beae0419b542b0461303785cc175e3518
2024-01-26 14:01:08 -08:00
Joseph Beshay
ead139adef Move all mvfst use-cases to the new Eventbase, Timer, and Socket interfaces
Summary:
This is the major transition that updates mvfst code to use the new interfaces. The new Folly implementations of the interfaces maintain all the existing behavior of folly types so this should not introduce any functional change. The core changes are:
- Update the BatchWriters to use the new interfaces.
- Update the FunctionLooper to use the new interfaces.
- Change QuicServerTransport to take the folly types and wrap them in the new types for use in the QuicTransportBase.

The rest of the diff is for updating all the existing uses of the QuicTrasnport to initialize the necessary types and pass them to the QUIC transport instead of directly passing folly types.

Reviewed By: mjoras

Differential Revision: D51413481

fbshipit-source-id: 5ed607e12b9a52b96148ad9b4f8f43899655d936
2023-12-14 00:24:12 -08:00
Joseph Beshay
cc9ccc8f99 Remove ThreadLocalBatchWriter
Summary: Remove ThreadLocalBatchWriter since it's not being used.

Reviewed By: mjoras

Differential Revision: D50809221

fbshipit-source-id: 3754e64320518165654217b1e368429c69a944c5
2023-11-07 14:51:15 -08:00
Brandon Schlinker
a1445434b0 Cleanup and modularize receive path, improve timestamp support [5/x]
Summary:
This diff changes `QuicAsyncUDPSocketWrapper` so that it is an abstraction layer that inherits from `QuicAsyncUDPSocketType`, instead of simply being a container with aliases.
- Key changes in `QuicAsyncUDPSocketWrapper.h`, the rest of the updates switch us from using `QuicAsyncUDPSocketType` to `QuicAsyncUDPSocketWrapper`.
- It's difficult to mock the UDP socket today given that we expose the entire `folly::AsyncUDPSocket` type to the higher layers of the QUIC stack. This complicates testing and emulation because any mock / fake has to implement low level primitives like `recvmmsg`, and because the `folly::AsyncUDPSocket` interface can change over time.
- Pure virtual functions will be defined in `QuicAsyncUDPSocketWrapper` in a follow up diff to start creating an interface between the higher layers of the mvfst QUIC stack and the UDP socket, and this interface will abstract away lower layer details such as `cmsgs` and `io_vec`, and instead focus on populating higher layer structures such as `NetworkData` and `ReceivedPacket` (D48714615). This will make it easier for us to mock or fake the UDP socket.

This diff relies on changes to `folly::MockAsyncUDPSocket` introduced in D48717389.

--

This diff is part of a larger stack focused on the following:

- **Cleaning up client and server UDP packet receive paths while improving testability.** We currently have multiple receive paths for client and server. Capabilities vary significantly and there are few tests. For instance:
  - The server receive path supports socket RX timestamps, abet incorrectly in that it does not store timestamp per packet. In comparison, the client receive path does not currently support socket RX timestamps, although the code in `QuicClientTransport::recvmsg` and `QuicClientTransport::recvmmsg` makes reference to socket RX timestamps, making it confusing to understand the capabilities available when tracing through the code. This complicates the tests in `QuicTypedTransportTests`, as we have to disable test logic that depends on socket RX timestamps for client tests.
  - The client currently has three receive paths, and none of them are well tested.

- **Modularize and abstract components in the receive path.** This will make it easier to mock/fake the UDP socket and network layers.
  - `QuicClientTransport` and `QuicServerTransport` currently contain UDP socket handling logic that operates over lower layer primitives such `cmsg` and `io_vec` (see `QuicClientTransport::recvmmsg` and `...::recvmsg` as examples).
  - Because this UDP socket handling logic is inside of the mvfst transport implementations, it is difficult to test this logic in isolation and mock/fake the underlying socket and network layers. For instance, injecting a user space network emulator that operates at the socket layer would require faking `folly::AsyncUDPSocket`, which is non-trivial given that `AsyncUDPSocket` does not abstract away intricacies arising from the aforementioned lower layer primitives.
  - By shifting this logic into an intermediate layer between the transport and the underlying UDP socket, it will be easier to mock out the UDP socket layer when testing functionality at higher layers, and inject fake components when we want to emulate the network between a mvfst client and server. It will also be easier for us to have unit tests focused on testing interactions between the UDP socket implementation and this intermediate layer.

- **Improving receive path timestamping.** We only record a single timestamp per `NetworkData` at the moment, but (1) it is possible for a `NetworkData` to have multiple packets, each with their own timestamps, and (2) we should be able to record both userspace and socket timestamps.

Reviewed By: jbeshay, hanidamlaj

Differential Revision: D48717388

fbshipit-source-id: 4f34182a69ab1e619e454da19e357a6a2ee2b9ab
2023-09-21 07:57:58 -07:00
Konstantin Tsoy
2b0d0b2f2b Separate batch writer into multiple modules
Summary: Separate batch writer into multiple modules

Reviewed By: hanidamlaj, mjoras

Differential Revision: D47112819

fbshipit-source-id: f6b4fd64ab99541f1923ae9c432e5a1fb0986fef
2023-07-13 18:39:45 -07:00
Konstantin Tsoy
4a0dd1e2a4 QuicAsyncUDPSocketWrapper
Reviewed By: jbeshay

Differential Revision: D46379200

fbshipit-source-id: f6a7c1cf68108872e05e6fd8adb7f00aae22b2ed
2023-07-11 15:21:15 -07:00
Matt Joras
7f885554cc Add reserve len as parameter to packet builder
Summary: This allows us to not reserve for the DSR path.

Reviewed By: hanidamlaj

Differential Revision: D46787596

fbshipit-source-id: dcd97b1190f4559b8798b1a78b1508effee84753
2023-06-16 15:50:23 -07:00
Matt Joras
22ffdc1c41 Don't append frame metadata to builder.
Summary: There's no point in doing this for the DSR backend, as we don't use the frame metadata.

Reviewed By: hanidamlaj

Differential Revision: D46787595

fbshipit-source-id: 027fdc0dfe2e45b8b82d506446c8be9090cef939
2023-06-16 15:50:23 -07:00
Matt Joras
4a9d569669 Implement inplace writes for DSR backend.
Summary:
This improves the performance of DSR packet writing. The thread local contiguous buffer is transparently allocated on the first write.

We store the relevant data in a fake connection state so as to not change the existing (somewhat janky) batch writer interface. In the future we should refactor this so it's less ugly.

Reviewed By: kvtsoy

Differential Revision: D46765252

fbshipit-source-id: cf0bb66a3c4ea7b76ade4e99cb65ce42774ed810
2023-06-15 13:05:32 -07:00
Matt Joras
dd357a0a4e Set batch size to request group size
Summary: As in title. The comment here was right all along. In practice this doesn't matter that much, but it matters significantly to synthetic performance tests like tperf.

Reviewed By: shodoco

Differential Revision: D46726195

fbshipit-source-id: fe22d12a7ac3a237a30b5d0d19cc9a0fd7a21e11
2023-06-14 10:23:07 -07:00
Matt Joras
e2be4562a1 Use createCombined more frequently.
Summary: This is a pretty obvious thing to do. There's not really any reason to have the data and metadata separately since we don't need to reallocate.

Reviewed By: jbeshay

Differential Revision: D36237370

fbshipit-source-id: 093ad7fb2c54b596ea5cc327ffcc24de1748d362
2022-05-09 23:47:37 -07:00
Jianfeng Tang
00e369e592 update writePacketsGroup to return both the number of packets and bytes have been sent
Summary: Currently writePacketsGroup returns the number of packets it sent. Update it to return the number of bytes has been sent too.

Reviewed By: mjoras

Differential Revision: D34280604

fbshipit-source-id: 5cc4047401a00054a2bc0a0e7429a3beaa046f44
2022-02-18 16:24:18 -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
Matt Joras
88991dd58a Refactor RequestGroup, persist ciphers.
Summary: This makes the RequestGroup its own struct so we don't have so much redundant information in the requests.

Reviewed By: shodoco

Differential Revision: D32175496

fbshipit-source-id: 7365f55133f2eeebd16b8a534e7e4ce08842d327
2021-11-09 16:55:08 -08:00
Matt Joras
612a00c3f9 Move happy eyeballs state to client state.
Summary: This doesn't belong in the generic state. Untangling it is a little difficult, but I think this solution is cleaner than having it in the generic state.

Reviewed By: JunqiWang

Differential Revision: D29856391

fbshipit-source-id: 1042109ed29cd1d20d139e08548d187b469c8398
2021-07-23 14:21:16 -07:00
Yang Chi
3560e52ba6 Move QUIC DSR Backend to OSS: quic/dsr/backend dir
Summary: as title

Reviewed By: mjoras

Differential Revision: D27999776

fbshipit-source-id: c092bc18c5212d5f6f1d0dfcb59f26645d448701
2021-05-10 16:55:12 -07:00