Why does Kademlia use UDP?

dht, kademlia, networking, udp

Solution

The main reason is that you rapidly query many nodes that you have never established contact to before and possibly will never see again during a lookup.

Kademlia lookups are iterative, i.e. requests won't be forwarded. A forwarding DHT would be more suited to long-standing TCP connections.

I.e. a large chunk of the traffic consists a short-lived exchange of a request and response between nodes of a network potentially ranging in the millions. The overhead of rapidly establishing thousands of TCP connections would be prohibitive.

Problem

Why does the Kademlia Distributed Hash Table use UDP as its network transport protocol, even though it's unreliable?

Original source