Skip to content

Commit

Permalink
Merge pull request #11734 from rgacogne/ddist-nodelay
Browse files Browse the repository at this point in the history
dnsdist: Set TCP_NODELAY on the TCP connection to backends
  • Loading branch information
rgacogne authored Jul 5, 2022
2 parents e3f602d + 059c8f5 commit cc2371c
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions pdns/dnsdistdist/dnsdist-tcp-downstream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ bool ConnectionToBackend::reconnect()
auto socket = std::make_unique<Socket>(d_ds->d_config.remote.sin4.sin_family, SOCK_STREAM, 0);
DEBUGLOG("result of socket() is "<<socket->getHandle());

/* disable NAGLE, which does not play nicely with delayed ACKs.
In theory we could be wasting up to 500 milliseconds waiting for
the other end to acknowledge our initial packet before we could
send the rest. */
setTCPNoDelay(socket->getHandle());

#ifdef SO_BINDTODEVICE
if (!d_ds->d_config.sourceItfName.empty()) {
int res = setsockopt(socket->getHandle(), SOL_SOCKET, SO_BINDTODEVICE, d_ds->d_config.sourceItfName.c_str(), d_ds->d_config.sourceItfName.length());
Expand Down

0 comments on commit cc2371c

Please sign in to comment.