Lowering Your DNS Carbon Footprint
The Domain Name Service (DNS) is the means by which machine addresses (IP) can be found from their more human consumable names. For example www.google.com can be translated to 220.127.116.11 and 2a00:1450:4009:80b::2004.
DNS is the backbone of modern network communications upon which all of the services we use every day rely. Whenever you visit any website, post to social media, chat on instant messages, stream a movie or adjust your heating from your phone the systems you use are using DNS, extensively, to make sure the right services go to the right place.
Between 2016 and 2021 the number of DNS transactions has doubled, from 2 trillion per month to 4 trillion. At the peak of the pandemic, when so many people were locked down, the number of requests ballooned to 8 trillion.
Those numbers are difficult to visualise so imagine if those were requests for phone numbers from a telephone operator and the operator could answer every enquiry, accurately, in exactly one second. If that were the case it would take them 127,000 years to handle just one month's queries.
Transactions Use Energy
Every DNS transaction uses energy, mostly in the form of electricity for the computers, routers and air conditioners in the datacentres. Each one is, therefore, responsible for a tiny amount of carbon emissions. However, when you multiply 'tiny' by a huge number like 4 trillion, you still end up with a very big number.
So if we all minimise the DNS transactions we can make a significant contribution to carbon reduction.
Of course, it isn't as easy as that and to understand why not we need to understand a little bit about how DNS works.
Domain Name Hierarchy
When a name is used, e.g. typed into a browser, the local computer uses a resolver which checks to see if it already knows a valid IP for that name. If not, it then starts working through the dotted sections of the full name from right to left.
All resolvers know the 13 IP addresses of what are called the 'root servers' and it will send a query to one of those to find where to get information on the rightmost part of the domain name (.uk, .com etc). The root server responds with an address of the lower level nameservers that handle that part (.uk will be different from .com).
The query process continues until the resolver finds a nameserver that can give an authoritative answer for the full name.
To speed the resolving process up, authoritative nameservers tag each IP address to tell resolvers how long they are valid for. This is called the time-to-live or TTL. The resolvers can then keep a local note of that name/IP pair for the duration of the TTL. If it is asked for the address for the name again, it checks it is still within the TTL period and if it is hand back the address without any other transactions.
It seems logical, then, that to green our DNS we just make the TTLs really big? Well, the maximum practical TTL is 7 days and you could set that for all of your names. If you did that, when you changed anything, such as moving your website to a new host, you would have a period of (at least) 7 days where some people saw your old website and some people your new one depending upon when they looked up the address originally. Your regular visitors would, probably, be those that had to wait for the longest.
So universal long TTLs is not the only answer as you need short ones for operational flexibility.
A method of providing ease of management is what's called the Canonical name or CNAME. This record exists for a full name, www.mydomain1.co.uk, but all it does is point to another full name, www.mydomain2.com. It is often used when two names have the same IP address and makes life easier for the domain manager to manage just one set of addresses.
Sounds useful? Yes, it is, especially when you might be using multiple domains to point to one set of services. However, imagine asking for the phone number of your local swimming baths and the authoritative response you get is that it is the same as your local council. If you don't already know the local council address you have to make a second request to find out what that is.
So CNAMES provide ease of management but they increase the number of lookups needed to resolve them.
What's the Optimum for Reduced Carbon Emissions?
That's the big question! We've covered two of the simplest issues here but there are over 40 other record types that could be causing wasteful DNS inefficiency.
The answer, therefore, is that it will vary wildly from domain to domain. One thing that is certain, however, is that just blindly adding IP addresses/CNAMES into a web admin panel isn't going to be anywhere near!
Each record needs to be considered in the context of the business priorities and its technical purpose clearly understood. By having an expert look through your DNS zone files you can almost guarantee to save millions of transactions and the associated carbon emissions without losing significant business flexibility.
Once you have done this, the work isn't over. As the business priorities change you need a responsive management service to advise on pre-emptive DNS changes. For example, if you know you are going to move email services you can wind the TTLs on the mail exchange (MX) records down in the days before the move so that the switch happens very fast. Then, once the new service is bedded in, wind them back up again to the most environmentally friendly settings you can support.
What Can You Do?
You have three options:
- Ignore it. The world is burning anyway, what's a little extra from your DNS zone?
- Do it yourself. If you have the time and capability to do the research and ongoing maintenance, then all of the answers are out there in the search engines. You will probably have to move your nameservers to a greener provider with a comprehensive management interface and API.
- Outsource it. Let an expert team, committed to a low carbon world, do it for you. That's exactly what our DNS Service offers using Google's CloudDNS and their efficient data centres.
Greening your DNS is a task that defies total automation because unpredictable, human, decision making directly impinges upon it. So please, please don't choose number 1.
This isn't just about loving the planet and sleeping well at night knowing you've done your bit. There's also a payoff.
It may not be instantly obvious, but a low carbon DNS zone is, by its very nature, an efficient DNS zone. If you are minimising transactions you are also reducing the time it takes for the person making the request to get a valid answer. This directly impacts how fast your services appear to run. Two direct results of that are:
- Improved user satisfaction. People like fast loading websites and services and they buy from services they like.
- SEO. Google loves fast loading web sites and services and will rank them accordingly. Higher rankings will send more users to your site to experience your fast page loads.
It's not rocket science but more, happier users of your services will have a direct, positive impact on your business goals.
Saving the planet one transaction at a time really is good for business!