Question: What is the difference between TCP and UDP? When is TCP used instead of UDP?
Answer: SQL Server databases are shared across different locations , so it’s important to understand network communications . To read on the importance network tuning and monitoring read SQL Server – netstat monitoring and tuning performance (SQL ...
The main difference between UDP (User Datagram Protocol ) and TCP (Transmission Control Protocol) is in the handling of the data packets when sent.
TCP is all about guaranteeing the recipient receives the packets in order . When the recipient receives a packet, a message is sent back to sender . If the response is not valid, the sender will resend. There is also some extra activity around checking for errors
UDP also deals with packets being sent. But the sender just continues sending the packets, it doesn’t wait for a response from recipient. As the recipient if you miss the packets – you can’t retry.
From a performance perspective , as UDP does not have this extra overhead – i.e sending messages back to sender and error checking , UDP offers greater performance . Whereas TCP offers greater reliability
Of course , the applications decide which protocol to use , weighing up latency and loss tolerance concerns.
In RDBMS cluster setups it’s not unusual to see UDP used. A private network cluster requires a fast protocol with low overhead. Handshakes are not used to confirm the recipient is ready to receive packets.The question is why would an application use UDP? I suppose if you had a super reliable network with zero packet loss you may decide to utilise UDP
Read More on Network Communications and tuning