]> git.ipfire.org Git - thirdparty/pdns.git/commit
dnsdist: Implement read-ahead support for incoming TLS connections
authorRemi Gacogne <remi.gacogne@powerdns.com>
Wed, 21 Jun 2023 08:55:28 +0000 (10:55 +0200)
committerRemi Gacogne <remi.gacogne@powerdns.com>
Thu, 7 Sep 2023 08:22:02 +0000 (10:22 +0200)
commite80c3b09f318380b6536cfdd83c07b1c8a84edd7
tree16a85887518ae03671768fdb36d2c55b6d0eeca7
parent188dbe7176cbb364b45eec5e622263989ebd79fd
dnsdist: Implement read-ahead support for incoming TLS connections

Read-ahead instructs OpenSSL to read more than the number of bytes
we requested from the incoming connection, if possible, and to buffer
it. This provides a huge performance boost by reducing the number
of syscalls because in most cases the data is already available on
the socket to be read even if we cannot know that yet without reading
the data length.
There are two drawbacks:
- we can keep reading on a connection in a loop as long as there is
  data available, which should be prevented by our number of concurrent
  requests limit ;
- we need to always try to read all the data available before asking
  the kernel to wake us up when the socket is readable, because the
  data buffered by OpenSSL is obviously not visible to the kernel so
  we could wait forever.
pdns/dnsdist-lua.cc
pdns/dnsdist-tcp.cc
pdns/dnsdistdist/dnsdist-nghttp2-in.cc
pdns/dnsdistdist/dnsdist-nghttp2-in.hh
pdns/libssl.hh
pdns/tcpiohandler.cc