Just to clarify a little more, Raft doesn't rely on TCP, though many
implementations do use it.
The way I think about it, TCP provides four things:
1. Ordering/duplicate elimination
Raft doesn't rely on the ordering guarantees or duplicate elimination
at the transport layer; its RPCs contain enough information to be
processed out of order safely. Also, most Raft implementations would
need to deal with TCP connections failing by connecting again, where
at least the duplicate elimination guarantees are lost.
2. Retransmission
TCP includes acknowledgements and the sender will retransmit lost
packets (up to the point that the connection is considered failed).
Again, most Raft implementations need to deal with TCP connections
failing by trying again, so the code to do retries is already going to
be there at the application level. And Raft's RPC replies serve as
acknowledgements already.
3. Large message assembly, flow control, and congestion control
If you're sending large amounts of data, it's a pain to have to
reimpement this stuff at the application layer. This is a big win for
using TCP sockets, but it's really just a convenience; there's nothing
fundamental about the network stack doing this instead of your
application.
4. Deployment advantages
Finally, from what I hear, UDP and other protocols aren't always
supported very well, especially in clouds and wide area networks. TCP
is probably just easier to deploy and operate.
So the least fundamental of these from a theoretical point of view,
(3) and (4), are the best reasons to use TCP, in my opinion.
-Diego