neqo icon indicating copy to clipboard operation
neqo copied to clipboard

Consider increasing OS send socket buffer (`SO_SNDBUF`)

Open mxinden opened this issue 1 year ago • 6 comments

For increased performance, we might want to increase the OS UDP socket send and receive buffer.

See also:

  • https://man7.org/linux/man-pages/man7/socket.7.html
    • SO_SNDBUF
    • SO_RCVBUF
  • https://github.com/google/quiche/blob/95857ee25d30c1dc09f1c36cbe7a29b969a11f6d/quiche/quic/core/quic_udp_socket_posix.inc#L195
  • https://github.com/quic-go/quic-go/blob/8f1110450bad0b41f8dd03ea8cf24c299a9c9a20/sys_conn_helper_linux.go#L35
  • https://github.com/quinn-rs/quinn/blob/693c9b7cfbf89c541ba99523237594499984ffed/README.md#usage-notes

mxinden avatar Jul 04 '24 09:07 mxinden

Are we currently running with the OS defaults? What do other stacks use?

larseggert avatar Jul 04 '24 12:07 larseggert

Are we currently running with the OS defaults?

In Firefox we attempt to set it to 1 MiB. I wasn't aware of this until today trying to add another pref.

# Receive buffer size of QUIC socket
- name: network.http.http3.recvBufferSize
  type: RelaxedAtomicInt32
  value: 1048576
  mirror: always

https://searchfox.org/mozilla-central/rev/01aaa47e62a2015e7641f26ab0bc2bb00ab579b8/modules/libpref/init/StaticPrefList.yaml

mxinden avatar Jul 11 '24 10:07 mxinden

Thanks for finding this out. We could do the same in neqo, but would it be worth it?

Do we also do something for the send buffer?

larseggert avatar Jul 11 '24 10:07 larseggert

As far as I can tell we only alter the receive buffer, not the send buffer. I am not familiar enough with the code base to know for sure.

We could do the same in neqo, but would it be worth it?

:+1: worth experimenting with in neqo-server and neqo-client.

mxinden avatar Jul 11 '24 10:07 mxinden

I think we should – both in Firefox and neqo – bump the RX and TX buffers up. On TX, it should reduce the "would block" occurrences, and on RX it might reduce drops-in-the-stack.

larseggert avatar Feb 24 '25 17:02 larseggert

Keeping this open to track send buffer increase experimentation.

mxinden avatar Apr 02 '25 16:04 mxinden