Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perf: use recvmmsg in addition to GRO #2137

Draft
wants to merge 69 commits into
base: main
Choose a base branch
from

Commits on Sep 8, 2024

  1. perf: don't allocate in UDP send & recv path

    This change is best summarized by the `process` function signature.
    
    On `main` branch the `process` function looks as such:
    
    ```rust
    pub fn process(&mut self, dgram: Option<&Datagram>, now: Instant) -> Output {
    ```
    
    - It takes as **input** an optional reference to a `Datagram`. That `Datagram` owns
    an allocation of the UDP payload, i.e. a `Vec<u8>`. Thus for each incoming UDP
    datagram, its payload is allocated in a new `Vec`.
    - It returns as **output** an owned `Output`. Most relevantly the `Output` variant
    `Output::Datagram(Datagram)` contains a `Datagram` that again owns an allocation of
    the UDP payload, i.e. a `Vec<u8>`. Thus for each outgoing UDP datagram too, its
    payload is allocated in a new `Vec`.
    
    This commit changes the `process` function to:
    
    ```rust
    pub fn process_into<'a>(
        &mut self,
        input: Option<Datagram<&[u8]>>,
        now: Instant,
        write_buffer: &'a mut Vec<u8>,
    ) -> Output<&'a [u8]> {
    ```
    
    (Note the rename to `process_into` is temporary.)
    
    - It takes as **input** an optional `Datagram<&[u8]>`. But contrary to before,
    `Datagram<&[u8]>` does not own an allocation of the UDP payload, but represents
    a view into a long-lived receive buffer containing the UDP payload.
    - It returns as **output** an `Output<&'a [u8]>` where the
    `Output::Datagram(Datagram<&'a [u8]>)` variant does not own an allocation of the
    UDP payload, but here as well represents a view into a long-lived write buffer
    the payload is written into. That write buffer lives outside of
    `neqo_transport::Connection` and is provided to `process` as `write_buffer: &'a
    mut Vec<u8>`. Note that both `write_buffer` and `Output` use the lifetime `'a`,
    i.e. the latter is a view into the former.
    
    This change to the `process` function enables the following:
    
    1. A user of `neqo_transport` (e.g. `neqo_bin`) has the OS write incoming UDP
    datagrams into a long-lived receive buffer (via e.g. `recvmmsg`).
    2. They pass that receive buffer to `neqo_transport::Connection::process` along
    with a long-lived write buffer.
    3. `process` reads the UDP datagram from the long-lived receive buffer through
    the `Datagram<&[u8]>` view and writes outgoing datagrams into the provided
    long-lived `write_buffer`, returning a view into said buffer via a `Datagram<&'a
    [u8]>`.
    4. The user, after having called `process` can then pass the write buffer to the
    OS (e.g. via `sendmsg`).
    
    To summarize a user can receive and send UDP datagrams, without allocation in
    the UDP IO path.
    
    As an aside, the above is compatible with GSO and GRO, where a send and receive
    buffer contains a consecutive number of UDP datagram segments.
    mxinden committed Sep 8, 2024
    Configuration menu
    Copy the full SHA
    5d847ee View commit details
    Browse the repository at this point in the history

Commits on Sep 9, 2024

  1. Merge Encoder impl blocks

    mxinden committed Sep 9, 2024
    Configuration menu
    Copy the full SHA
    b334e84 View commit details
    Browse the repository at this point in the history

Commits on Sep 10, 2024

  1. Fix tests

    mxinden committed Sep 10, 2024
    Configuration menu
    Copy the full SHA
    2db53a2 View commit details
    Browse the repository at this point in the history
  2. clippy

    mxinden committed Sep 10, 2024
    Configuration menu
    Copy the full SHA
    9fef795 View commit details
    Browse the repository at this point in the history

Commits on Sep 14, 2024

  1. fix some, ignore some

    mxinden committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    995c499 View commit details
    Browse the repository at this point in the history
  2. Always run bench

    mxinden committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    1c653de View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c05bc64 View commit details
    Browse the repository at this point in the history
  4. Revert "fix some, ignore some"

    This reverts commit 995c499.
    mxinden committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    08eba9d View commit details
    Browse the repository at this point in the history
  5. Remove process_multiple_input

    mxinden committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    ae112c8 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    828da75 View commit details
    Browse the repository at this point in the history
  7. Consolidate process functions

    mxinden committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    dfa33b2 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    763b391 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    8dee7b3 View commit details
    Browse the repository at this point in the history
  10. New TODO

    mxinden committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    5576875 View commit details
    Browse the repository at this point in the history
  11. Copy only for Datagram &[u8]

    mxinden committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    b9457bb View commit details
    Browse the repository at this point in the history
  12. Fix more tests

    mxinden committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    94d1a68 View commit details
    Browse the repository at this point in the history
  13. remove all public process_output

    One can just use process(None, ...)
    mxinden committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    e2d1452 View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    2e2a76e View commit details
    Browse the repository at this point in the history
  15. Remove process_2

    mxinden committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    1947d33 View commit details
    Browse the repository at this point in the history
  16. Intra doc links

    mxinden committed Sep 14, 2024
    Configuration menu
    Copy the full SHA
    8ea56b2 View commit details
    Browse the repository at this point in the history

Commits on Sep 15, 2024

  1. Thread local receive buffer

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    3df6660 View commit details
    Browse the repository at this point in the history
  2. Cleanup UdpSocket::recv_inner

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    52dfa91 View commit details
    Browse the repository at this point in the history
  3. Revert "Thread local receive buffer"

    This reverts commit 3df6660.
    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    8699209 View commit details
    Browse the repository at this point in the history
  4. Fix fuzzing

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    1b9259c View commit details
    Browse the repository at this point in the history
  5. Reduce diff

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    07c2b3b View commit details
    Browse the repository at this point in the history
  6. Runner::new

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    14a9643 View commit details
    Browse the repository at this point in the history
  7. Cleanup server

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    f0855e1 View commit details
    Browse the repository at this point in the history
  8. Cleanup datagram.rs

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    936ea2b View commit details
    Browse the repository at this point in the history
  9. Rename new_with_buffer to new

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    19a82cd View commit details
    Browse the repository at this point in the history
  10. simplify codec.rs

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    55adc20 View commit details
    Browse the repository at this point in the history
  11. Remove encode_into

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    1cee426 View commit details
    Browse the repository at this point in the history
  12. Document segment_size

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    e9dd74d View commit details
    Browse the repository at this point in the history
  13. Cleanup datagram.rs

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    99a323e View commit details
    Browse the repository at this point in the history
  14. Configuration menu
    Copy the full SHA
    147df66 View commit details
    Browse the repository at this point in the history
  15. Fix fuzz

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    3928c62 View commit details
    Browse the repository at this point in the history
  16. Fix fuzzing

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    34d904e View commit details
    Browse the repository at this point in the history
  17. Address TODO

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    7f6ca94 View commit details
    Browse the repository at this point in the history
  18. Configuration menu
    Copy the full SHA
    bd325fe View commit details
    Browse the repository at this point in the history
  19. Minor changes

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    28f9b0a View commit details
    Browse the repository at this point in the history
  20. Remove outdated TODO

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    7cae54f View commit details
    Browse the repository at this point in the history
  21. build_vn test

    mxinden committed Sep 15, 2024
    Configuration menu
    Copy the full SHA
    b03f8d4 View commit details
    Browse the repository at this point in the history

Commits on Sep 19, 2024

  1. Configuration menu
    Copy the full SHA
    2003c84 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    38179ef View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    fbccdf2 View commit details
    Browse the repository at this point in the history
  4. Fix docs

    mxinden committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    24e0cbd View commit details
    Browse the repository at this point in the history
  5. Rename write_buffer to out

    mxinden committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    6deaef8 View commit details
    Browse the repository at this point in the history
  6. Re-introduce process_output

    mxinden committed Sep 19, 2024
    Configuration menu
    Copy the full SHA
    5244fc1 View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2024

  1. Address minor TODOs

    mxinden committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    15eb2f8 View commit details
    Browse the repository at this point in the history
  2. Encode update frame directly

    mxinden committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    ffc3708 View commit details
    Browse the repository at this point in the history
  3. Document panic

    mxinden committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    e5bc0e2 View commit details
    Browse the repository at this point in the history
  4. Remove outdated clippy allow

    mxinden committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    eb09a9a View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    5ab4e01 View commit details
    Browse the repository at this point in the history
  6. Fix build_insufficient_space

    mxinden committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    08c49e6 View commit details
    Browse the repository at this point in the history
  7. Fix build_two

    mxinden committed Sep 25, 2024
    Configuration menu
    Copy the full SHA
    2b0103a View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    c254319 View commit details
    Browse the repository at this point in the history

Commits on Sep 27, 2024

  1. Configuration menu
    Copy the full SHA
    1bd20da View commit details
    Browse the repository at this point in the history
  2. No unsafe in recv_inner

    No need to play with fire (uninitialized memory). Simply initialize the recv
    buffer once at startup.
    mxinden committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    8137e73 View commit details
    Browse the repository at this point in the history
  3. Minor TODOs

    mxinden committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    166ae86 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    93c1fa5 View commit details
    Browse the repository at this point in the history
  5. Simplify server.rs

    mxinden committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    3a134d6 View commit details
    Browse the repository at this point in the history
  6. Polonius workflow

    mxinden committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    61565b4 View commit details
    Browse the repository at this point in the history
  7. Remove duplicate runs-on

    mxinden committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    f65dde5 View commit details
    Browse the repository at this point in the history
  8. newline

    mxinden committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    c6f58dc View commit details
    Browse the repository at this point in the history
  9. Duplicate only

    mxinden committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    55e650f View commit details
    Browse the repository at this point in the history
  10. Fix diff

    mxinden committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    92c48de View commit details
    Browse the repository at this point in the history
  11. Configuration menu
    Copy the full SHA
    a4d1ef2 View commit details
    Browse the repository at this point in the history
  12. Clippy

    mxinden committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    75c1de2 View commit details
    Browse the repository at this point in the history
  13. Update diff

    mxinden committed Sep 27, 2024
    Configuration menu
    Copy the full SHA
    1ce5455 View commit details
    Browse the repository at this point in the history

Commits on Sep 28, 2024

  1. feat: use recvmmsg in addition to GRO

    Previously we would only do GRO.
    mxinden committed Sep 28, 2024
    Configuration menu
    Copy the full SHA
    f9bd792 View commit details
    Browse the repository at this point in the history