| Here's the inevitable Twitter cripple-fight between me and Dan: http://bettween.com/tqbf/dakami/Jan-03-2011/Jan-04-2011/desc Here's what I think happened: * Dan wrote this DNS proxy thing for DNSSEC (which, don't use DNSSEC, it's evil) called "phreebird". * Phreebird uses libevent, which tends to produce zippy fast servers, so Dan benchmarked it and found TCP was faster than UDP. * But Dan made a bunch of mistakes with libevent and, in fairness, BSD sockets in general; in particular, he only events the read side of the conversation --- his writes block. Since the socket buffers on the TCP side are spread out across a bunch of sockets, and there's only one UDP socket buffer, the UDP socket blocks a lot. Dan says that when he says TCP is "faster", he means "it gets better throughput, even though it may not get better latency". Now, I think "latency vs. throughput" is a refuge for scoundrel arguments, but just to make sure, I checked, and if you wail on Google DNS with a TCP connection, you cannot in fact clear 1000 queries faster than if you firehose it with UDP. This just makes sense, since TCP has congestion control overhead and strict in-order delivery and UDP doesn't. |