4 ms·
TCP is used if the size of the packet goes over 512 bytes. Practically this is only used for zone transfers. It's also faster... Assuming everything works, it'
by swalberg 16y ago
TCP is used if the size of the packet goes over 512 bytes. Practically this is only used for zone transfers.
It's also faster... Assuming everything works, it's one round trip time for the query and response for UDP, as opposed to 2 for the TCP case because you have to set up the connection first.
Being connectionless means that the server can be much more efficient, because it never has to keep track of any connections or state.
And, as others have pointed out, you just retransmit if you don't get an answer. TCP isn't really lossless, it just guarantees that you know when you've lost something which is an important distinction. And with DNS, that's pretty easy -- you didn't get your answer. TCP would take a while to figure this out, with UDP you can pick your timeout.
- IgorPartola 16y agoYou also have to tear the connection down with 2 more round trips. Connections not being closed by the client are a drain on the server.
- ay 16y agoAlso, to establish the TCP connection you need an extra roundtrip compared to the UDP use case. Given that in the case of no answer in the cache the recursive name server may need to ask several authoritative name servers - this can add significantly to the delay, too.
- trotsky 16y agoFYI, EDNS0 (Extension mechanisms for DNS) is supported by most clients and allows for large UDP packets (configurable to MTU) and includes other extensions. Common uses for > 512 byte packets are records that include several entries of both A and AAAA type, as well as all DNSSEC replies. It's from RFC2671 proposed in 1999. The only snag is that some consumer firewalls still don't support > 512 bytes when proxying DNS. http://en.wikipedia.org/wiki/Extension_mechanisms_for_DNS http://en.wikipedia.org/wiki/Extension_mechanisms_for_DNS