You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, while using the DNS client I have noticed a performance challenge if a TCP or DNS-over-TLS server is used to resolve queries, this compared against an UDP server (that said, 1.5x-2.0x times slower for TCP, and up to 4x times slower for DNS-over-TLS), so in the long term, there is a drastic performance drop for a heavily used DNS client (e.x.: local server proxy/forwarder).
That performance drop is mainly caused by the opening/closing of a new TCP connection for every DNS request, and the required handshake things that are inherit to the protocol (worse for a TCP TLS handshake).
So, as an improvement, it may be good to have an option to reuse an already made TCP connection and send the requests over it, reducing the handshake things over and over again, specially for a DNS-over-TLS server, where a cert is involved.
As a general idea:
Add a new bool flag to enable/disable the reuse of TCP connections (not valid for UDP) client.go#L30
Add a new client attribute with the reusable connection client.go#L30
On every request, check if the reusable connection is NOT nil/closed, and use that connection client.go#L160
If the connection is nil/closed, make the Dial call to establish a new connection client.go#L162
Avoid closing the connection after the message exchange finishes client.go#L167
Add an idle timeout to check for inactive connections and automatically close them
Add a handler to check/capture connection state changes (I don't know if that is possible)
The text was updated successfully, but these errors were encountered:
Hi, while using the DNS client I have noticed a performance challenge if a TCP or DNS-over-TLS server is used to resolve queries, this compared against an UDP server (that said, 1.5x-2.0x times slower for TCP, and up to 4x times slower for DNS-over-TLS), so in the long term, there is a drastic performance drop for a heavily used DNS client (e.x.: local server proxy/forwarder).
That performance drop is mainly caused by the opening/closing of a new TCP connection for every DNS request, and the required handshake things that are inherit to the protocol (worse for a TCP TLS handshake).
So, as an improvement, it may be good to have an option to reuse an already made TCP connection and send the requests over it, reducing the handshake things over and over again, specially for a DNS-over-TLS server, where a cert is involved.
As a general idea:
Dial
call to establish a new connection client.go#L162The text was updated successfully, but these errors were encountered: