A sustainable approach to the web

A presentation at Umbraco Spark 2023 in March 2023 in Bristol, UK by Thomas Morris

Slide 1

Slide 1

A Sustainable Approach to the web Neil Clark and Thomas Morris

Slide 2

Slide 2

Contents Context 01 Tech tips 02 What we can do 03

Slide 3

Slide 3

Hello Umbraco Spark!

Slide 4

Slide 4

Neil Clark Planet Officer and Service Design Lead linkedin.com/in/nrclark/

Slide 5

Slide 5

Thomas Morris Technical Lead Umbraco Certified Master @mozzydev

Slide 6

Slide 6

01 Context

Slide 7

Slide 7

Organisational design & change Technology and engineering Digital experience Enterprise applications Data & artificial intelligence Managed services

Slide 8

Slide 8

People, Planet, Community We’re committed to building sustainable futures for our People, our Planet and our Communities. People Planet Community Decreasing pay gaps, representation gaps and gaps in inclusivity. Employee wellbeing and satisfaction. Measuring, reducing and removing our carbon footprint. Removing barriers for our employees. Leading industry change. We are equipping our communities with future-proof skills, kickstarting 5,000 digital careers.

Slide 9

Slide 9

Our planet strategy Employees Organisation Clients & Partners Empower our employees Leave no trace Drive change in our industry Collective action Behavioural change Ways of working Measure, reduce and remove our footprint Planet projects

Slide 10

Slide 10

The climate crisis doesn’t happen in a vacuum Climate change isn’t solely an environmental issue. It’s rooted in a web of ethical, political, and systemic issues. A lot of these issues overlap with tech, design, and how we do business. 🎧 Listen to Introduction to climate justice ▶ Watch A chat about climate justice This slide has been stolen with love from Sandra Pallier 🙏

Slide 11

Slide 11

Emissions Sources & Natural Sinks

Slide 12

Slide 12

It was COP27 🥳

Slide 13

Slide 13

It was COP27 🤬

Slide 14

Slide 14

It was COP27 🤬

Slide 15

Slide 15

It was COP27 🤬

Slide 16

Slide 16

It was COP27 🤬

Slide 17

Slide 17

It was COP27 🤬

Slide 18

Slide 18

It was COP27 🤬

Slide 19

Slide 19

Why does that matter to organisations? Ed Hawkins | showyourstripes.info | Ocean temp 1850-2021

Slide 20

Slide 20

The digital industry is responsible for around 4% of global emissions; above that of the aviation industry…

Slide 21

Slide 21

… And since the Paris Agreement, average web page size has increased almost 60% on desktop and over 125% on mobile

Slide 22

Slide 22

More high level trends…

Slide 23

Slide 23

Why isn’t the planet a stakeholder in digital projects? Lack of awareness Lack of breadth and depth of research No universally accepted standards Sustainability isn’t a non functional requirement as per security, performance or accessibility Greenwashing from major stakeholders Multiple different calculation methods

Slide 24

Slide 24

But this isn’t just a developer or engineering problem Engineering Company leadership Research Product Ownership UI/UX Content Infrastructure QA

Slide 25

Slide 25

What needs to be done? 1 2 3 4 Energy efficiency Hardware efficiency Carbon awareness Inform and educate Actions taken to make software consume less electricity when performing its functions Actions taken to make software need fewer physical resources when performing its functions Actions taken to understand how much carbon is on the electricity grid and react accordingly, to use renewable energy Raises awareness of why digital things cause emissions and how that is being addressed

Slide 26

Slide 26

What needs to be done? 1 2 3 4 Energy efficiency Hardware efficiency Carbon awareness Inform and educate Actions taken to make software consume less electricity when performing its functions Actions taken to make software need fewer physical resources when performing its functions Actions taken to understand how much carbon is on the electricity grid and react accordingly, to use renewable energy Raises awareness of why digital things cause emissions and how that is being addressed

Slide 27

Slide 27

02 Technical tips

Slide 28

Slide 28

Guidelines We have standards and checklists for other aspects of the web. You can test and get a score. 1 Accessibility 2 Security 3 Performance What do we have for sustainability?

Slide 29

Slide 29

Guidelines There is no accepted checklist for sustainability, but there is progress.

W3C working group Green Software Foundation BIMA sustainability council We will show you some of the approaches you can take and would be a good starting point for consideration.

Slide 30

Slide 30

How do we measure all this?

Slide 31

Slide 31

EcoPing Set up a regular ping for your website’s carbon emissions

Where do my website’s resources come from? How green are they? Understand your monthly impact Diagnose issues Track changes over time

Slide 32

Slide 32

EcoPing

Slide 33

Slide 33

Slide 34

Slide 34

Technical tips We will look at this from 3 main areas of interest. Combined this can have a substantial impact on your footprint. 1 Infrastructure 2 Front end 3 Content

Slide 35

Slide 35

02.1 Infrastructure

Slide 36

Slide 36

What does it mean to be green?

Slide 37

Slide 37

Hosting options Data centres require a lot of energy to run.

How efficient are they? Do they use renewable energy? How is electrical waste handled? Green Web Foundation publishes a directory of green hosts: https://www.thegreenwebfoundation.org/directory/

Slide 38

Slide 38

Umbraco For Umbraco, we typically use Azure for hosting. Umbraco Cloud is also running on Azure for all it’s services. 1 Azure web apps 2 SQL elastic pools But what does this mean from a sustainability perspective? 3 Azure storage

Slide 39

Slide 39

Azure Azure, as a part of Microsoft, has been 100 percent carbon neutral since 2012. This means they are removing as much carbon each year as they emit, either by carbon removal (carbon Azure weboffsetting) apps or reducing SQLcarbon elastic pools emissions. 1 2 By 2025, Azure will shift to 100 percent supply of renewable energy. 3 Azure web apps

Slide 40

Slide 40

Is it really green? Whilst you may be hosted with a green provider, websites typically utilise resources that come from all across the world. 1 2 …andAzure not allweb countries energy. appsproduce green SQL elastic pools 3 Iceland - 100% renewable and low-carbon United Kingdom - mostly renewable, but also reliant on imports Azure web apps

Slide 41

Slide 41

Slide 42

Slide 42

Slide 43

Slide 43

Carbon aware development

Slide 44

Slide 44

Utilisation of electricity Consider when the grid is filled with renewable energy sources. If the grid is in high use, it may be using a high amount of fossil fuels.Azure web apps SQL elastic pools 1 2 Let’s revisit our electricity map… 3 Azure web apps

Slide 45

Slide 45

Slide 46

Slide 46

Optimise our code In development terms…

Send form submissions at a later time Batch up newsletter campaigns Apply patches outside of peak times Deploy when the grid is low intensity

Slide 47

Slide 47

Let’s deliver content close to our users

Slide 48

Slide 48

CDNs

Slide 49

Slide 49

CDNs By utilising a Content Delivery Network, we can deliver content efficiently.

Less travel time Less bandwidth Less effort from origin servers Greater performance More secure

Slide 50

Slide 50

Slide 51

Slide 51

How can we be efficient with data?

Slide 52

Slide 52

Server configuration 1 2 3 4 Turn on HTTP/2 Minify assets Compression Caching Allow for more requests, by loading them concurrently. Easy enable on most servers. Minify static files to keep the file sizes low Reduce file size even further using compression with Gzip/Brotli Cache responses effectively so that the server doesn’t have to work too hard

Slide 53

Slide 53

Serverless A serverless function could provide the experience we need

On demand resources Resources are allocated when needed Execute as individual functions Low impact

Slide 54

Slide 54

JAMstack Can we utilise a different approach?

JavaScript, APIs and Markup Serve static content Composable architecture Shift for developers Lots of hosting options

Slide 55

Slide 55

MACH alliance MACH is an industry tech standard describing modern technology.

Microservices APIs first Cloud native Headless

Slide 56

Slide 56

What about bad bots?

Slide 57

Slide 57

Bot army Not all bots are bad, but unfortunately 25% of traffic is from bad bots.

Submit junk data Hijack accounts Scrape content DDoS attacks Let’s look at some options we have…

Slide 58

Slide 58

Block requests

Robots.txt Rate limiting Block IPs Super Bot Fight Mode!

Slide 59

Slide 59

Let’s turn off what we don’t need

Slide 60

Slide 60

Dev/staging These websites are typically not needed that often

Extra resources Low usage Ramp up when needed Consider impact

Slide 61

Slide 61

Slide 62

Slide 62

Azure runbooks Set up Azure runbooks to amend resources when not in use

Use the Azure cli Schedule for regular times Switch off or scale down after work Automated quick win

Slide 63

Slide 63

02.2 Front end

Slide 64

Slide 64

Images are the most popular resource type on the web

Slide 65

Slide 65

Combined they consistently add the most to page weight

Slide 66

Slide 66

Slide 67

Slide 67

Image optimisation 1 2 3 4 Optimise upload Better formats Suitable sizes Caching Optimise images for storage, these can then be handled effectively Use newer formats such as Webp and AVIF in favour of JPEG or PNG Adjust images to the viewport of the user Cache images so the user doesn’t download multiple times

Slide 68

Slide 68

Optimal images Ensure the image stored is optimised in size

Use a tool to optimise Optimise during upload Show warnings within the CMS Upload the max size required

Slide 69

Slide 69

Serve the best format possible

Slide 70

Slide 70

Slide 71

Slide 71

Slide 72

Slide 72

JPEG

The most common format. Standard from the late 1980s. Supported in all major browsers. Lossy compression Our image is 1.01 MB as a JPEG file. 664 kB with some optimisation.

Slide 73

Slide 73

PNG

Widely used for high quality images Allows for transparency Launched in 1995 Supported in all major browsers. Lossless compression Our image is 7.46 MB as a PNG file.

Slide 74

Slide 74

WEBP

Designed to supersede JPEG and PNG Allows for transparency Launched in 2011 Supported in all major browsers. Lossy and lossless compression Our image is 363 kB as a WEBP file.

Slide 75

Slide 75

AVIF

Up to 10x smaller than JPEG Generally offers the best results Supported in some browsers. Introduced in Chrome August 2020. Lossy and lossless compression Our image is 294 kB as a AVIF file.

Slide 76

Slide 76

Slide 77

Slide 77

Picture tag

Allows us to support the best possible formats today. Can still support legacy browsers if we need to Browser will load the most relevant image <picture> <source srcset=”photo.avif” type=”image/avif”> <source srcset=”photo.webp” type=”image/webp”> <img src=”photo.jpg” alt=”…” width=”…” height=”…”> </picture>

Slide 78

Slide 78

Resource hints

Default behaviour for assets is eager loading Images are being loaded regardless of placement on the page Images only load when they come into view. <img src=”image.jpg” alt=”…” loading=”lazy” />

Slide 79

Slide 79

Await interaction

Turn off autoplay for videos Set preload to none to prevent browsers from loading data. Use a poster image to showcase where a video is used. <video controls preload=”none” poster=”placeholder.jpg”> <source src=”video.webm” type=”video/webm”> <source src=”video.mp4” type=”video/mp4”> </video>

Slide 80

Slide 80

Can we use an SVG instead?

Slide 81

Slide 81

How about the use of fonts?

Slide 82

Slide 82

Font optimisation 1 2 3 4 Optimise for use Better formats Limit variations Self host Optimise fonts for the device, and use custom styles sparingly Use only WOFF2 and forget about everything else. Reduce the number of font variations required to be efficient with usage Self host and use a CDN for caching of requests

Slide 83

Slide 83

Slide 84

Slide 84

Optimise for the device

Custom fonts need to download We can make use of fonts that are pre-installed on a device. Extra benefit in that they match the look and feel of the OS. :root { —system-ui: system-ui, “Segoe UI”, Roboto, Helvetica, Arial, sans-serif, … }

Slide 85

Slide 85

Optimise for delivery

Subset could be latin chars only Provide a hint for the unicode range Browser will download if it finds a match @font-face { font-family: LatoSubset; src: url(‘path-to-optimized-lato.woff2’) format(‘woff2’), url(‘path-to-optimized-lato.woff’) format(‘woff’); unicode-range: U+65-90, U+97-122; }

Slide 86

Slide 86

Self host If you do use custom fonts, then self host should be preferred. 1 2 UsingAzure Googleweb Fontsapps results in extra SQL elastic pools round trips (and tracking) Remove a reliance on a 3rd party 3 Azure web apps

Slide 87

Slide 87

Can we make sustainable design choices?

Slide 88

Slide 88

Sustainable design 1 2 3 4 Colour choice Image use Low carbon Inform Use a more sustainable colour palette as certain colours use more energy Use smaller images and in less places, say no to stock images and prefer illustrations. Adjust the design based on low grid intensity Be visible about your design choices and the impact we can have

Slide 89

Slide 89

Slide 90

Slide 90

Slide 91

Slide 91

Slide 92

Slide 92

02.3 Content

Slide 93

Slide 93

Redundant, out of date or trivial content?

Slide 94

Slide 94

ROTN content 1 2 3 4 Redundant Out of date Trivial No longer used Duplicate content, confusing to users and bad to the planet. It’s possible for content to go out of date as things change and don’t get audited. Content for content sake. Understand the value of the content being added. Review content that is no longer required and has no purpose.

Slide 95

Slide 95

Redundant How to reduce redundant content.

Content audits Card sorting Consider the page UX Editor warnings

Slide 96

Slide 96

Out of date How to reduce out of date content.

Content audits Show last updated Flag stale content in Umbraco Notify users

Slide 97

Slide 97

Trivial How to reduce trivial content.

Content audits If in doubt, leave it out Readability score, e.g. Preflight Editor warnings

Slide 98

Slide 98

Do you really need it? 1 2 3 4 Images Integrations Data Downloads Is it just decoration? What impact does it have? Can it be done with colour? Is it actually in use? Evaluate purpose and which sources are in use. Are they duplicated? Are they worth it? Ask only what is necessary. Define why it’s important. Keep data for as long as it’s needed. Review content that could be made available as HTML first content, e.g. instead of PDFs

Slide 99

Slide 99

Let’s be HTML first

Slide 100

Slide 100

HTML first Use web pages instead of PDFs

Avoids large downloads Web pages load upon request Provide suitable navigation Allow for search More accessible

Slide 101

Slide 101

03 What we can do

Slide 102

Slide 102

As an organisations/agency 1 2 3 4 Adopt low carbon practices Make it everyone’s problem Challenge your client’s brief Open source your ideas Formalise the why, how and what But make sure someone is really pushing it It’s easy at first but stick with it The successes and the failures; add to the bank of knowledge

Slide 103

Slide 103

Umbraco as a whole Umbraco functionality changes Hosting and infrastructure Community

Slide 104

Slide 104

Umbraco as a whole Umbraco functionality changes

AVIF support Aggressive defaults for backups, versions and other data storage Carbon aware defaults for backups, deployments, patches, resource allocation, versioning etc Device power consumption of rendering a page CO2e/page weight budgets and alerts

Slide 105

Slide 105

Umbraco as a whole Hosting and infrastructure

CDNs and caching Bot blocking Plugin management Payload compression Hosting transparency Make the planet a stakeholder of future hosting decisions, e.g. data centre locations

Slide 106

Slide 106

Umbraco as a whole Community

Can we set up a planet or low carbon focused community group? How do we maintain a dual focus on best practice when developing with Umbraco and changing the core of Umbraco? Could we publish a “What would a sustainable Umbraco community look like” as per Wordpress? How might the marketplace reflect the need for low carbon websites?

Slide 107

Slide 107

Questions?

Slide 108

Slide 108

Thank You