Climate change. It's real and it's bad. There aren't many human endeavours that aren't contributing to the catastrophe. Do you know how much carbon is released to power the internet?
It is estimated there are a billion websites. All those web pages need a web server to store markup, databases, images and media. Servers need power to run, buildings to be lit and server rooms to be kept cool with air conditioning. This accounts for around 0.5% of global emissions. Add the power to run the consumers laptops, phones and desktop computers and you are looking at 1% of global emissions, or ~300 million tonnes of CO2 per year. It's a lot, and it's going up quite quickly.
Around 300 million tonnes of CO2 per year, equivalent to every person in the UK flying to America and back twice over.
We can't switch it off or un-invent it, so how can we make the net more sustainable. The carbon usage is split into 48% for hosting, 14% for network & transportation and around 38% end user and equipment. So how to reduce this?
Many of the world's major hosting infrastructure companies have started moving to renewable energy. Google has led the way, already moving to 100% renewables. Amazon's AWS aims to get there by 2025 and has already started working towards that goal. Equinix has a "long term" goal to move to renewables. It's worth noting we don't have time for long term goals. EvoSwitch claims to use 100% renewables.
Websites need DNS hosting and a CDN as well as a web server. Kindleman use Cloudflare, who also claim to use 100% renewables.
That's all great news, but remember - hosting is only half of the carbon intensity of a website and some of these claims are disputed. They are certainly more complex than at first glance as much of the renewables claimed are offsets, not direct usage or new capacity installed for the data center. It's up to us to try to reduce the impact of our designs - not just hope that the infrastructure providers will fix everything.
Sustainable Web Design
Reduce the number of requests and the size of each request to reduce the load on the network, required hosting capacity and the power consumption of the users device. You should really be aiming for under 1Mb as a page weight budget.
Avoid unwanted audio and video streaming by turning off auto play.
Remove parts of your CSS/Sass framework that you are not using.
Review and remove JS libraries that you aren't using or can do without. Do you really need JQuery anymore?
Optimise your image assets and serve them at the right size.
Improve SEO & navigability of sites to reduce page views. Yes this seems like madness, but is it? Is there really value in your users having to navigate through a series of pages to find the content they want over dropping straight in from a well indexed page or via efficient navigation.
Additional benefits - Users with limited bandwidth get a reasonable experience, improved SEO, better UX, faster page load and longer battery life.
Really, this is just good web design, with side benefits. As with a lot of green initiatives, why not?
Back End Efficiency
Websites often run on a complicated back end system based on server side code providing logic and a database to store all the content - each blog post, or author or other data. Even for simple websites, these back end systems can be very resource intensive as they power a Content Management System that is very powerful and resource intensive. Generally CMS powered sites will build the page you ask for from the database and templates on the fly - meaning each time you view a page the server has to do a lot of computational work.
You can reduce this workload in a number of small ways, or one massive way. More of that later.
To work on your site's efficiency, make sure you have implemented the following:
As Martin Fowler wrote, there are two hard things, and caching is one of them. It has huge benefits though in terms of site performance, page speed, server capacity and (another new thing to worry about) carbon footprint. As caching is one of only two hard things in programming though, it's important to use a framework that makes it easy.
It's always been important to write fast, efficient code. But with climate change closing in and Moore's Law ending - it's more important than ever. Keep on top of best practices for your languages and keep memory and processor use down. Optimise your database with indexes. Use native language features where they exist as they will be more efficient than your own code as they run closer to the metal (in C).
I like to use a monitoring tool to spot bottle necks and then optimise those parts of an application. Like front end optimisation, there are side benefits including lower hosting costs, better UX via faster page loads and increased throughput.
Clear out the garbage.
Keep the disk use of your site to a nice tidy minimum. Wordpress, by default, downloads a new theme each year to your website. Most sites do not keep switching their theme so switch that off. Properly prepare your image and other assets for the web, with metadata stripped, file size carefully determined and image exported for the web - not directly from the camera phone.
Wait, the Massive Way
I promised a way to get a huge win in terms of back end performance. What is it? Don't have one. It's all the rage in web development, especially for site's that don't have a lot of complex functionality although you would be surprised what can be built without a traditional back end. This methodology is referred to as the JAM Stack.
The modern way to build [websites & apps] that delivers better performance.
Essentially, Jamstack involves managing your site data and compilation away from your web server so that it is compiled and deployed to a simple file-serving system. This means there is no compilation time, database access or template interpolation to perform each time a user visits a page. The whole thing becomes simpler, more secure and much, much faster.
People worry about carbon usage for the modern always-on digital life, but estimates are 2/3 of energy use is in manufacture & shipping. Only 1/3 in use. That's huge. How can you reduce that? Look for well made equipment that will last, made by responsible manufacturers that are trying to mitigate the impact.
Keep your kit for longer.
The University of Edinburgh, found that using a single desktop computer and monitor for six years instead of four, avoids the release of approximately 190kg CO2 equivalent.
My last desktop lasted nearly 10 years. Ten! It's important to have equipment that is still getting security updates from the software vendor and, of course, battling with old slow kit harms productivity - but do you really need to change your desktop more than every 5 years? Probably not.
Look after your equipment. Follow manufacturer guidance to look after battery life of phones, tablets and laptops. Clear out unused files and carry out routine maintenance tasks.
On average people keep their phones for 2-3 years. Are you replacing yours every year? Stop that. Nobody cares about keeping up now that pretty much all phones are awesome. Just look after it and replace when its useful life is up.
Apple committed to supporting iPhones for 7 years from end of manufacture. So I'm looking forward to using my SE Gen2 until at least 2028!
An alternative to an iPhone is a phone you can fix yourself so that when a screen is cracked or a battery fails you just switch out that part. If you like the idea of just replacing the bits that need it and like android, check out FairPhone.
Reduce your usage.
Finally, keep your usage down where that makes sense. Unsubscribe from newsletters to save the sending server and your mail server. Limit reply all to keep the world's inboxes light. Limit streaming services to audio when listening to music. Maybe even switch off. Go out and enjoy nature, the real world wide web.