13 ms·
The architecture of DNS is pretty solid, but the encodings are unnecessarily complex. That complexity has a huge, hidden opportunity cost. If anyone wants to h
by breck 13y ago
The architecture of DNS is pretty solid, but the encodings are unnecessarily complex. That complexity has a huge, hidden opportunity cost.
If anyone wants to help, I'm pretty confident a Space based encoding would greatly improve DNS:
https://github.com/nudgepad/space/issues/54 https://github.com/nudgepad/space/issues/54
- duskwuff 13y agoI'm not sure you actually understand what's going on here. The zone file that you're looking at is only used internally by the DNS server - it is never sent across the wire, so the verbosity of the format is largely irrelevant.
- breck 13y agoYou're right, I don't have a complete working knowledge of DNS, BIND, Zone, et cetera. Hence, the details of my DSL are going to be off. But I'm very confident in my hypothesis that the status quo is unnecessarily complex, all encodings could be reduced to Space DSLs, and doing so would lead to drastic unforeseen benefits. All it takes is someone with knowledge of the details to implement it. I'd do it myself, but am currently doing the same in other domains (right now on HTML, HTTP, CSS).
- vidarh 13y agoZone files is a side show. Many other DNS servers use entirely different formats, including formats that are more space efficient than what you suggest on your Github page, and some of which are not serialized to text files at all (all data stored in databases). These formats are not standardized at all. Note that your Bind zone file example is also quite verbose compared to what it needs to be. E.g. here's a more compact version: $ORIGIN brekyunits.com. $TTL 3600 @ IN SOA NS53.DOMAINCONTROL.com. dns.jomax.net. (2013041502 28800 7200 604800 3600 ) @ A 107.21.225.189 @ MX 0 smtp.secureserver.net. @ MX 10 mailstore1.secureserver.net. @ NS NS53.DOMAINCONTROL.com. @ NS ns54.DOMAINCONTROL.com. In comparison to that, yours doesn't seem to provide any real benefits that I can see. When it comes to the over the wire format, the over the wire format is designed to be much more compact, because if the request and response fits in a single UDP datagram, the request will be handled much faster - if the reply is too long, then the server might have to tell the client to retry over TCP, for example, which means two wasted packets to establish that, then about half a dozen packets or more for the request/reply over TCP. Your format would not help there. If you want to improve DNS, read the RFC's first.
- breck 13y agoThanks for the comments. I actually have read a lot of the RFCs. A Space DSL to replace all this stuff won't materialize out of thin air, someone will have to take the time to think it through and iterate a couple times. But I've been in the lucky position over the past while to see Space in action, and at this point I'm pretty confident that it will disrupt many areas, including DNS. I haven't done a good job of making my case. Talk is cheap, more Space code is coming. But my point in general is that all of these formats can be described as premature optimization. Or perhaps, no longer necessary optimization. The example you provided clearly illustrates that. Dollar signs, at signs, periods, parentheses and abbreviations galore. In my mind, the current state of things is ugly code. I can make sense of that. But someone off the street can't make sense of that. In my mind, that is a problem. That is a huge problem. The common reaction is to "teach people DNS". I'm off the opinion, "No, these formats suck! No need for all that complexity. The world has changed. Let's start looking ahead." To use a word mentioned earlier, I believe code should be trivial, as trivial as reading a road sign. I believe the Internet is due for a big refactor. I believe the unreadability of these formats is causing us a ton in lost innovation. Why should only l33t hackers be able to understand the full stack? There's no reason in my estimation, other than that the stack is permeated by ugly, unnecessary complexity. So many things people do nowadays over the Internet are done on top of 10 levels of abstraction when they could be done at 2 or 3. I think there is a real opportunity here for someone to improve upon DNS.
- vidarh 13y agoIt isn't a problem that someone off the street can't make sense of that, since it's a format that is an internal detail of a complicated tool. Someone off the street isn't expected to understand that: There's a plethora of tools that lets them enter stuff in other formats, and a plethora of web frontends. What they do need to understand, though, to do anything beyond the extremely trivial, is the DNS data model, and the Bind style zone files reflects that data model extremely directly, so almost whatever they end up with doing, they will sooner or later come across something that may remind them of the zone files. And I get that is a lot of what causes people to be concerned about Bind zone files. As I pointed out, there are lots of DNS servers where you won't see a Bind style zone file ever, and you don't need to require configuration to be done via a file at all. Djbdns is one of the former. ldapdns is one of the latter - that exposes DNS entries pulled out of an LDAP server. But both will be similar in structure because they map to the same data model. The only thing you will achieve by devising a format like what you describe on top of DNS is drive people crazy, because they now need to learn a format that does not map easily directly to the DNS data model (if it does, it will appear very similar to zone files and will be pointless). I've written a DNS server, that was used for a registrar platform (I co-founded the company that ran ".name"), and I didn't use zone files, but the data was still mostly the same. If you want to change that, beyond the extremely superficial (e.g. renaming "MX" to "mailserver" or similar) that will only confuse people communicating with those using the original names, you'd need to start lower: With the DNS data model and wire format. Good luck with that - there are trillions of dollars hinging on DNS working these days, and a lot of design decisions in DNS follows directly from real-life constraints that are not going to change. They are simple: The data must be small - if records are too large for a single UDP datagram, it slows things down instantly. A DNS record consists of a label, an address family (can usually be omitted, as almost everyone just uses "IN"), a resource type (A,CNAME,MX etc. - you could rename those in your format), a TTL (which can usually be left out to use the default), and a resource type specific data field which is usually a string, label or IPv4 or v6 address (obvious exceptions: MX, which includes the priorty, and SOA). You could possibly drop the address family, but as I pointed out, "everyone" just uses IN anyway, and most software will default to that if you leave it out. You can rename the record types to something "friendly", but you don't need to change internals of the software for that - just add a mapping to the UI of various tools - these query types are mapping to byte values internally in DNS servers anyway. So what do you think you'd achieve? What can make DNS more understandable without breaking functionality people depend on? > To use a word mentioned earlier, I believe code should be trivial, as trivial as reading a road sign. Not going to happen, because code implements real world requirements, and many real world requirements are far more complicated than reading a road sign. You can write a DNS server that is simple to understand for a programmer, though - DNS is not all that complicated. But then you don't need to mess with the DNS data model - it takes little effort to learn enough of it that zone files is not the problem. It took me less than a week to write my first fully functional DNS server without ever having looked at the RFC's before. If you want to tackle unnecessary complexity, look somewhere else, like IMAP (or get people to stop using SOAP...) - now there is ridiculous complexity for no good reason (there are reasons, they just aren't good) > Why should only l33t hackers be able to understand the full stack? Sometimes because it often takes a huge amount of basic knowledge about the domain to even understand what people are talking about. But you don't need that to understand DNS. Seriously. Read RFC 1034 and 1035. Equip yourself with "tcpdump", "dig" and or "nslookup". Write some DNS encoding and decoding routines based on the data in RFC 1034. Run tcpdump and do capture some queries that you carry out via dig or nslookup. Test your encoding and decoding routines to see that they match based on the dig input/output and captured packets until you have them working. Then write a simple authoritative resolver based on the rules in the RFC's (authoritative resolvers are simplest because you are only answering based on "I know this, it's in my local data set", as opposed to recursive resolvers that have to know when it is right to cache, when it is right to forward requests, who it should allow recursion for, and [these days] how to avoid being part of a DNS amplification attack unwittingly). That isn't much more complex than: Wait for incoming query; parse query; extract name it is asking for; if it is a name your server should serve, return the data you have for that name, otherwise return an error (handling corner cases will make it a bit more complex, such as handling fallback to TCP). If you have any prior network programming experience, this should be no more than a week of coding if you keep things simple. If you're experienced, you might even have something basic working (the "first 80%") within the day. At least if you pick something higher level than C to write it in. There are many areas to improve upon in DNS, but data model complexity is pretty much bottom of the list. I'd have agreed with your second to last paragraph if it was better targeted than against DNS.
- simoncion 13y agoAfter reading https://github.com/nudgepad/space/issues/54#issuecomment-21297690 https://github.com/nudgepad/space/issues/54#issuecomment-212... , I don't see how your method is superior to the existing BIND zonefile syntax. It requires one to keep significantly more state in one's head while editing the file and (because the meaning of the data in the file depends on where it is in the file) makes drive-by one-off editing much harder. (Being able to "echo '@ 60 IN A 1.1.1.1' >> my.zonefile.zone" is pretty convenient.)
- breck 13y agoThanks for the comment. I'm sure there's a much better DSL than the one I proposed, perhaps that takes into account the ability to append to the file. My theorem though, is that there exists a Space DSL that is 10--100x better than the current BIND syntax. In other words, you can accomplish everything that BIND does, using a syntax that is general/universal. The latter part is what gives you the 10x-100x improvement over BIND. Learning BIND provides you almost no benefit in other domains, and worse, mastering other languages is irrelevant when you encounter BIND. Why am I so confident in this? We've been applying Space in all sorts of domains, and time and again it comes up that it works in any domain, better than the existing specific languages. The benefit if you know how to use Space--and knowing Space takes less than 20 minutes to master it for a programmer since there are 3 rules, 2 syntax characters (space and newline), and it is impossible to have a syntax error--you then can easily read and write code that works across all sorts of domains--HTML, CSS, Makefiles, BIND, HTTP---et cetera. I'm a seasoned programmer (15,000 hours experience), and looking at BIND makes me groan. Now, the DSL I whipped up I'm sure is not the DSL that could replace BIND--I took less than 7 minutes to come up with that one and my knowledge of BIND/DNS is only partially--but I'm highly confident that it is relatively close and with a few tweaks you could create a DSL that is better than the status quo. Which is pretty amazing because this is so level that your work would improve the Internet and DNS in a significant way.
- simoncion 13y agoFrankly, I don't understand what's so complicated about HOST TTL [CLASS] TYPE RDATA Even the SOA record's RDATA is pretty simple: AUTHORITATIVE_NAMESERVER ADMIN_EMAIL_ADDR (SERIAL_NUMBER REFRESH_INTERVAL UPDATE_RETRY_INTERVAL EXPIRE_INTERVAL NXDOMAIN_CACHE_INTERVAL)
- spc476 13y agoI was hoping you were referring to the wire-format for DNS, in which the keys (the domain/host names) are stored using a unique compression scheme (which in my experience is rather hard to enode and you have to be careful when decoding to detect loops). But no, you are talking about BIND zone files, which I don't find all that complex.
- breck 13y agoI'm talking about the whole kit and kaboodle. All of the formats. I'm pretty much of the opinion that almost all of these formats are no longer needed optimizations.
- lttlrck 13y agoSo we should ditch decades of work and switch to less efficient formats and accept the enormous aggregate performance hit and lose hard won security and interop benefits? Brilliant!
- breck 13y agoI'm saying let's throw them all away starting today. We'll turn off the internet for a while but when we switch it back on it will be way better. :) Kidding of course. Despite my optimism for this, I'm a pragmatist. It would take many years to switch, and would be a gradual process. I have just seen time and again how if you make things simpler, more natural, you reap drastic rewards. Look at the introduction of touch interfaces. Hundreds of millions of people are now using more powerful computers than most of us owned just a few years ago. I believe there's a huge pent up demand for people who want to get their hands on the DNS layer of the Internet, and simplifying the protocols would be one big step toward allowing that to happen.
- ioquatix 13y agoPerhaps you'd be interested in RubyDNS... also, what is so good about space, compared to YAML, JSON, XML, and many other existing coding standards?
- breck 13y agoGreat question. Space is just doubling down on the good parts of XML, JSON, and YAML; while stripping out anything that isn't absolutely necessary. It turns out, almost every feature in those encodings is unnecessary. Space is a total accidental discovery. We were just using a few ways to store objects (JSON, HAML, some others). We kept having to simplify the rules because we needed formats that worked with a variety of languages and eventually we had a very simple YAML like language. But even that was too complicated to support across languages, and so we kept cutting features and rules. Pretty soon we were down to no punctation. Just the space character and newline character to give structure to your objects. I was very surprised to discover that this was all you needed no matter what domain you were working in.