Skip to content

Use TCP_NODELAY on TLS sockets to speed up the TLS handshake.#1214

Merged
gthess merged 1 commit into
masterfrom
bugfix/tls-handshake
Jan 10, 2025
Merged

Use TCP_NODELAY on TLS sockets to speed up the TLS handshake.#1214
gthess merged 1 commit into
masterfrom
bugfix/tls-handshake

Conversation

@gthess

@gthess gthess commented Jan 10, 2025

Copy link
Copy Markdown
Member

Setting TCP_NODELAY on TLS sockets speeds up the TLS handshake.
Also noted on https://docs.openssl.org/3.4/man3/SSL_connect/#notes.

It was observed that during the handshake the server waits before sending more handshake data for the client ACK (Nagle's algorithm), which is delayed because the client waits for more data before ACKing (delayed ACK).

Old versions of OSes don't seem to experience the handshake delay (e.g., Ubuntu 20.04).
Tested with the same compiled versions of Unbound and OpenSSL across OS versions.
Maybe something changed in the kernel (or the kernel configuration) but couldn't pinpoint anything in particular.

Fixes #1045, #1185, #1202.

@gthess gthess requested a review from wcawijngaards January 10, 2025 11:25
@gthess gthess self-assigned this Jan 10, 2025

@wcawijngaards wcawijngaards left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better speed on the handshake may improved DNS lookup latency. The code looks fine, for setting the nodelay option.

@gthess

gthess commented Jan 10, 2025

Copy link
Copy Markdown
Member Author

Thanks!

@gthess gthess merged commit 7e4f7ec into master Jan 10, 2025
gthess added a commit that referenced this pull request Jan 10, 2025
- Merge #1214: Use TCP_NODELAY on TLS sockets to speed up the TLS
  handshake.
@gthess gthess deleted the bugfix/tls-handshake branch January 10, 2025 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Low Throughput Issue with unbound DNS over TLS on Ubuntu 22.04

2 participants