tqbf Thomas H. Ptacek
Dan, DNS lookups over TCP are 10-20ms slower than UDP lookups. Your measurement code is broken.

January 3, 2011 #

dakami Dan Kaminsky
@tqbf On latency, you always get +1RTT, which you can then amortize across some number of queries. Throughput grows though

January 4, 2011 #

tqbf Thomas H. Ptacek
@dakami I have no idea what you're trying to say. All I did was: actually measure, over many hundreds of queries, TCP vs. UDP.

January 4, 2011 #

dakami Dan Kaminsky
@tqbf let me clarify then: traditionally, we thought if everyone ran dns over tcp, it would knock over name servers

January 4, 2011 #

dakami Dan Kaminsky
@tqbf ...because they would have to dedicate too many resources to each open socket

January 4, 2011 #

dakami Dan Kaminsky
@tqbf with modern libevent socket handling though, mass tcp sockets are now fast and low resource

January 4, 2011 #

tqbf Thomas H. Ptacek
@dakami Are you saying this because it SOUNDS true, or are you going to post measurement code? Because: TCP is 20ms slower.

January 4, 2011 #

dakami Dan Kaminsky
@tqbf and of course I'm going to post measurement code.

January 4, 2011 #

tqbf Thomas H. Ptacek
@dakami I can verify it in less than 2 minutes.

January 4, 2011 #

tqbf Thomas H. Ptacek
@dakami Because you got up on stage and told people TCP was faster and said "I have no idea why". It isn't.

January 4, 2011 #

dakami Dan Kaminsky
@tqbf this all came up because the reason we went with source port randomization, rather than TCP upgrade, was server perf

January 4, 2011 #

dakami Dan Kaminsky
@tqbf we thought it would be too slow to tc bit all UDP transactions

January 4, 2011 #

tqbf Thomas H. Ptacek
@dakami You know what I totally believe you about all of this but I can't get past "TCP is faster than UDP" because it clearly isn't.

January 4, 2011 #

dakami Dan Kaminsky
@tqbf throughput was what was burning us.

January 4, 2011 #

dakami Dan Kaminsky
@tqbf throughput was what was burning us.

January 4, 2011 #

asteingruebl Andy Steingruebl
@dakami @tqbf On this topic though, seriously, you're going to need a ton of work to benchmark. Does CPU usage count? etc.

January 4, 2011 #

dakami Dan Kaminsky
.@asteingruebl @tqbf this all really comes up when the question is, can we tunnel DNSSEC over HTTP to get around firewalls?

January 4, 2011 #

asteingruebl Andy Steingruebl
@dakami @tqbf OK, sure we can, we can also tunnel it over ICMP.. :) A lot of feasibility depends on the nameserver, keepalives, etc.

January 4, 2011 #

dakami Dan Kaminsky
@tqbf So while there's a round trip latency hit, your server's total qps actually increases.

January 4, 2011 #

tqbf Thomas H. Ptacek
@dakami Ok, give me a server that answers both TCP and UDP where I will see TCP responses come back faster.

January 4, 2011 #

dakami Dan Kaminsky
@tqbf you're not listening. It's not faster in terms of latency. It's faster in terms of throughput.

January 4, 2011 #

tqbf Thomas H. Ptacek
@dakami You're saying, if I connected to a nameserver and asked 1000 queries, they'd come back faster with TCP?

January 4, 2011 #

dakami Dan Kaminsky
@tqbf if that nameserver was built off libevent, yes. I really need to put together the repro steps.

January 4, 2011 #

tqbf Thomas H. Ptacek
@dakami You realize libevent works fine with UDP, and that TCP is rate limited and UDP isn't, right?

January 4, 2011 #

dakami Dan Kaminsky
@tqbf you realize I actually wrote a libevent based DNSSEC proxy with UDP TCP and HTTP endpoints, don't you?

January 4, 2011 #

tqbf Thomas H. Ptacek
@dakami I'd have to modify the UDP side to be dumb enough to simply hammer the server with 1000 back to back queries, but, no big deal.

January 4, 2011 #

dakami Dan Kaminsky
@tqbf sure, you mod your code, I'll boot up a box

January 4, 2011 #

dionthegod Dion
@dakami I'm not arguing sandboxes are impenetrable. I agree with @chrisrohlf and @dinodaizovi -- kernel bugs are many times cheaper

January 4, 2011 #

dakami Dan Kaminsky
@dionthegod so for sandboxes to be effective you must posit an attacker who can afford the expensive bug but not the cheap one

January 4, 2011 #

dionthegod Dion
@dakami If you assume kernel locals will always be this cheap

January 4, 2011 #

vrybdpkt vrybdpkt
@tqbf @dakami does what I'm reading amount to "my implementation and use case" and not anything modeled and measured?

January 4, 2011 #

dakami Dan Kaminsky
@vrybdpkt @tqbf Nah, there's definite modeling and measuring going on. Otherwise I'd be tweeting and not rebuilding the environ

January 4, 2011 #

vrybdpkt vrybdpkt
@dakami @tqbf I've got to say I don't see how TCP can be faster than UDP. All things being equal UDP responds by the time the TWH is done.

January 4, 2011 #

tqbf Thomas H. Ptacek
@vrybdpkt The 3WH is amortized over many queries, but UDP keeps firehosing when packets get dropped and doesn't slow-start.

January 4, 2011 #

vrybdpkt vrybdpkt
@tqbf still, that's slower, not faster service from TCP.

January 4, 2011 #

tqbf Thomas H. Ptacek
@vrybdpkt You and I are saying exactly the same thing, but I think I see why Dan thought it was faster.

January 4, 2011 #

vrybdpkt vrybdpkt
@tqbf that is like saying pipelining and keep alive are outright faster than concurrent HTTP requests.

January 4, 2011 #

tqbf Thomas H. Ptacek
@dakami I have a libevented UDP and TCP DNS client right here if I'm wrong and you actually have a DNS server to point me at.

January 4, 2011 #

dakami Dan Kaminsky
@tqbf non-libevent stacks *crumble* on throughput, which was what was so surprising.

January 4, 2011 #

dakami Dan Kaminsky
@tqbf big 'ol post coming on this

January 4, 2011 #