News for hackers. Stuff that matters.
Re:HTTP/2 Frequently Asked Questions by teddyh on Friday October 03, 2014 @05:13AM (#8404788)
Here is a question I hoped to be answered, but it wasn’t: Why doesn’t the HTTP/2 protocol use SRV DNS records¹? Using it would solve some real problems:

1. The well-known resilience of mail can be largely attributed to its use of MX records to specify the use of backup servers and/or load balancing. SRV records are essentially a generalization of MX records for any service, not just mail, so using SRV records would bring this benefit to any protocol which uses them.

2. The problem of “www” or no “www” would be entirely eliminated; no need for non-standard so-called ANAME or ALIAS “records”. Just imagine – if, in an alternate universe, mail servers hadn’t used MX records, it would then have been necessary to have an A record on the bare domain name, and later, when the Web was created in this alternate universe, the web server would have to be the same server as the mail server, since both now would use the bare domain name. In our universe, this position is now solely occupied by the HTTP protocol, which causes lots of pain in the DNS when redundant (and harder to update) A records need to be put on the bare domain name just for HTTP. Not to mention IPv6, which, for HTTP to work, requires an additional AAAA record on the bare domain.

3. The “everything is on port 80, let’s reinvent everything on top of HTTP” problem could certainly have been entirely avoided, and could be slowly fixed, by using SRV records. (A server concerned about clients needing to traverse old-style restrictive firewalls could provide a low-priority port 80 server as a fallback.)

① A DNS RR for specifying the location of services (DNS SRV) https://tools.ietf.org/html/rfc2782

Re:HTTP/2 Frequently Asked Questions by Lukasa on Friday October 03, 2014 @06:10AM (#8404893)
> Why doesn't the HTTP/2 protocol use SRV DNS records?

This was discussed by the WG. The best rationale is given in the thread starting from this mail[0] from Will Chan at Google, followed up by this one[1] from Amos Jeffries (Squid Proxy). The summary is: waiting for SRV lookups can be slower than just doing straight-up A records, so no client in a competitive space is going to do it.

Everyone agrees that in an ideal world this would be great, but in practice no-one is going to be the first person to move on that front. The wins aren't big enough and the cost is too high.

[0]: http://lists.w3.org/Archives/Public/ietf-http-wg/2014JanMar/... [1]: http://lists.w3.org/Archives/Public/ietf-http-wg/2014JanMar/...

Re:HTTP/2 Frequently Asked Questions by teddyh on Friday October 03, 2014 @06:56AM (#8404977)
I am not convinced. The same argument (“another round-trip makes it slow”) is sometimes made about Javascript libraries, and the corresponding counter-argument applies here, too: It’s usually cached, anyway, and DNS caches are also much better, since DNS record caching is much more deeply integrated in your OS, your ISP, etc, than HTTP caching, which is usually only in each individual HTTP client. The cache times are also longer for DNS (or could certainly be so, since with SRV handling redundancy there is no need to keep low TTLs anymore).
Re:HTTP/2 Frequently Asked Questions by Lukasa on Friday October 03, 2014 @08:16AM (#8405144)
Notice that Amos was arguing for a happy-eyeballs approach, which removes the round trip. The issue isn't the wait for an extra round trip, it's making it mandatory to wait for an SRV result before using an A result.

If the language says "You MUST consult SRV records for _http2._tcp before you use the result of an A lookup", then anything that delays that SRV lookup will delay page resolution. Browsers are strongly disincentivised from making anything slow, so it's just safer not to add the extra delay point. If we specced that, no-one would do it.

Better to have what we have now, which is: do SRV if you want.

Re:HTTP/2 Frequently Asked Questions by teddyh on Friday October 03, 2014 @08:57AM (#8405291)
The SRV record should normally be cached, so it would not be slow just for existing.

What Amos was talking about is the problem of some resolvers not returning an answer at all, not even NXDOMAIN or an empty authoritative answer, due to the fact that he queried for AAAA records and some resolvers are buggy and can’t handle those queries. SRV is irrelevant to this problem, except that using “happy-eyeballs” and requiring A and AAAA has problems.

What William Chan (陈智昌) was talking about was where a query for SRV records fail, causing a long timeout. But this is not the normal case; normally you get an answer (perhaps an empty one) immediately. And since this has nothing to do with IPv6 and buggy resolvers, I don’t know why this situation should be considered common enough to optimize for. (Clients which really wanted to mitigate this could certainly detect this case when it happens and keep a blacklist.)

Re:HTTP/2 Frequently Asked Questions by teddyh on Friday October 03, 2014 @07:24PM (#8408171)
> […] anything that delays that SRV lookup will delay page resolution.

You keep implying that such things will happen. They won’t. There is no reason for an SRV record lookup to delay page resolution any more than an A (or AAAA) record lookup.

> If we specced that, no-one would do it.

Are you seriously saying that even if the HTTP/2 standard came out and it said “A client MUST lookup an SRV record and use it if one exists, and not use any A or AAAA records before the non-existence of an SRV record can be confirmed.”, that the browser vendors would simply ignore this? If that’s the case, why do we even have a standards process? Why do we even pretend to write RFCs if we can just assume that every implementer will ignore the standard and do whatever they feel like?

No, a thing which would be a net win for the Internet in general should go in the standard. RFC writers should not bow to fears of what Google, IBM, or General Motors might or might not do. Or, at least, wait until they make the threat of non-compliance openly.

Re:HTTP/2 Frequently Asked Questions by jamespo on Friday October 03, 2014 @07:50AM (#8405090)
Agreed, additionally in the common case of users behind http proxies, dns caches would commonly be populated.
Re:HTTP/2 Frequently Asked Questions by inopinatus on Saturday October 04, 2014 @02:54AM (#8408967)
Last I looked, the HTTP/2 RFC didn't even specify DNS at all.

I regard this as the worst-case scenario. It is a baffling omission. The HTTP URI scheme [RFC7230] does nothing to clarify matters:

"If host is a registered name, the registered name is an indirect identifier for use with a name resolution service, such as DNS..."

In my view the WG has the opportunity to definitively fix the problems of dual-stack discovery and of apex record service names, and the refusal to do so is exceedingly disappointing. We're left with implementations of Happy Eyeballs that have lookup race conditions and therefore nondeterministic behaviour.

All the arguments against using service records are actually complaints about artefacts arising from the current ambiguity in resolution practices, and thereby perpetuate the problem.

The proper choice should be that all IPv6 sites should be resolved via SRV rather than raw AAAA lookup - this is the soft introduction that over the years will ramp up to a global first preference for service records, and remains compatible as a variation on Happy Eyeballs.

But entrenched positions don't change and I have no clout with the WG or with browser product managers, so I gave up.

Re:HTTP/2 Frequently Asked Questions by nl on Friday October 03, 2014 @06:44AM (#8404959)
Interesting.

Reading that I'm not sure the problem is that SRV lookups are slower, but that forcing clients to do a SRV lookup, wait, and then a A/AAAA queries is slower:

If I own a popular client and I switch to mandatory SRV lookup, and don't issue A and AAAA queries until the SRV lookup fails, then for the services and paths where SRV lookup doesn't work, user experience will be vastly degraded.[1]

However,it appears that making SRV optional remains a possibility:

Note that none of what I've said necessarily applies to optionally doing SRV and using it when the results are available.

[1] http://lists.w3.org/Archives/Public/ietf-http-wg/2014JanMar/...

Re:HTTP/2 Frequently Asked Questions by belorn on Friday October 03, 2014 @08:21AM (#8405158)
Multi-request resolving (QDCOUNT > 1) would solve that problem, which is a lesser known feature of the DNS protocol. Clients could ask for all A, AAAA, and SRV for a given domain, and get all the replies in a single round-trip.

Few if any resolvers support this feature, but it show that the problem we have is because of legacy assumption that are no longer true. Fix those, and the problem goes away.

: https://www.ietf.org/rfc/rfc1035.txt

Re:HTTP/2 Frequently Asked Questions by teddyh on Friday October 03, 2014 @06:23PM (#8407957)
The key words in your quote is “for the services and paths where SRV lookup doesn't work”. You get the same problem today where A lookup doesn’t work. This is an abnormal situation. As I wrote in another comment, normally you get an answer immediately (possibly an empty one where no SRV record exists). I don’t know why a situation with no reply should be considered common enough to optimize for. (Clients which really wanted to mitigate this could certainly detect this case when it happens and keep a blacklist.)
Re:HTTP/2 Frequently Asked Questions by Lukasa on Friday October 03, 2014 @08:13AM (#8405138)
Correct, but you don't need the RFC to make SRV optional. If you'd like to use it, use it.
Re:HTTP/2 Frequently Asked Questions by teddyh on Friday October 03, 2014 @08:25AM (#8405170)
No, on the contrary, the SRV standard specifies that clients SHOULD NOT use SRV records for protocols for which the standards do not explicitly allow for SRV records.
Re:HTTP/2 Frequently Asked Questions by nl on Friday October 03, 2014 @05:31AM (#8404821)
I've recently done some work using SRV (for Minecraft, which uses it).

I agree it's a pretty decent system, and something I'd like to see more systems adopt it.

Interestingly, I can't actually think of a reason why a (customised) web browser couldn't use it now. If a browser understood SRV records it could use the correct port. There might be some odd interactions with the HTTP 1.1 Host header, but I haven't thought about it much.

Of course, browsers that don't understand it wouldn't be able to follow links that use it which is something of a downside I guess.

Re:HTTP/2 Frequently Asked Questions by teddyh on Friday October 03, 2014 @06:01AM (#8404870)
According to the RFC for SRV records, applications SHOULD NOT use SRV records unless explicitly allowed in the standard/RFC for that protocol. There is no mention of SRV records in either the old HTTP RFC or the new HTTP/2 draft RFC; therefore, clients are not permitted to use SRV records.

(I wrote about this previously here on HN: https://news.ycombinator.com/item?id=7522208)

Re:HTTP/2 Frequently Asked Questions by nl on Friday October 03, 2014 @06:23AM (#8404921)
SHOULD NOT prohibits nothing.

Indeed, since the HTTP/1.1 RFC was issued in 1999 and the SRV RFC in 2000 there is no way it could have mentioned it.

If there are technical reasons why it can't work that's one thing. If some verbiage in the RFC is all that holds it back it's easy to fix: try it out, then issue a new RFC.

The whole RFC process embraces changes like this.

Re:HTTP/2 Frequently Asked Questions by gsnedders on Friday October 03, 2014 @08:30AM (#8405186)
For those unaware of the RFC 2119 definition:

   SHOULD NOT   This phrase, or the phrase "NOT RECOMMENDED" mean that
   there may exist valid reasons in particular circumstances when the
   particular behavior is acceptable or even useful, but the full
   implications should be understood and the case carefully weighed
   before implementing any behavior described with this label.
Re:HTTP/2 Frequently Asked Questions by teddyh on Friday October 03, 2014 @07:05AM (#8404991)
> SHOULD NOT prohibits nothing.

And an RFC is not a standard, and all life is meaningless? No, a SHOULD NOT should be taken seriously, not ignored.

The SRV RFC included that language for a reason, and probably had HTTP in mind when they wrote it, and therefore wanted HTTP clients not to use SRV records randomly. Since then, HTTP has has plenty of time to add SRV usage in its minor revisions, but has chosen not to. But now, with HTTP/2, a major revision, it is the perfect time to add this kind of thing.

Re:HTTP/2 Frequently Asked Questions by nl on Friday October 03, 2014 @08:00AM (#8405120)
I'm sorry - I just read that other thread you linked to. Others made the same point to you then, and you still seem stuck on that point.

RFCs are not like ISO standards. The name says it all: "request for comments".

RFCs reflect the ideal of "rough consensus and running code".

The SRV RFC was written by an author from Microsoft aimed at domain controller discovery. They probably didn't think of HTTP at all.

There's an expired draft RFC for SRV+HTTP[1].

You are right: SHOULD NOT should be taken seriously. But if you are (say) Mozilla, Microsoft or Google and writing a webbrowser you probably know enough to understand when you can break a RFC.

How do you think TCP-fast-start happened?

[1] http://tools.ietf.org/html/draft-andrews-http-srv-01

Re:HTTP/2 Frequently Asked Questions by teddyh on Friday October 03, 2014 @08:17AM (#8405151)
Different RFCs have different levels. RFC 2782 is a “Standards Track” RFC and a “Proposed Standard”, and should be taken seriously indeed (there is only one “higher” level).

The SRV RFC was not by Microsoft. It has three authors, the other two being one Arnt Gulbrandsen from Troll Tech (of the Qt library fame) and Paul Vixie of the Internet Software Consortium, who is also the author of BIND. I actually am inclined to think that they did consider HTTP seriously.

Re:HTTP/2 Frequently Asked Questions by drdaeman on Friday October 03, 2014 @11:27AM (#8405928)
We have a tradition of introducing hacks over kludges. Don't break it.