1 of 48

Thibaud Colas, he/him�Developer

Faster, leaner, greener: 10x lower website carbon emissions

2 of 48

2

3 of 48

3

Wagtail users

4 of 48

Disclaimer

4

5 of 48

Our challenge

5

6 of 48

119,120

6

7 of 48

119,120

7

tCO2e/year emissions for�52,531 Django sites

Source: my own data: 2024 Django sites emissions

8 of 48

8

9 of 48

9

10 of 48

10

11 of 48

Our goal

11

12 of 48

10x (Net Zero)

12

Our goal

10x lower carbon emissions�for as many websites as possible

13 of 48

10x (Net Zero)

13

Our goal

10x lower carbon emissions�for as many websites as possible

Source: -90% target from SBTi Corporate Net-Zero Standard

14 of 48

How we get there

14

15 of 48

15

16 of 48

16

17 of 48

System segments: where emissions come from

  • 22% Data centersEnergy required to house and serve data.
  • 24% NetworksAn allocation of energy used by networks to transfer data.
  • 54% User devicesEnergy used by end users interacting with a product or service.

17

18 of 48

18

19 of 48

19

20 of 48

Things we can do

20

21 of 48

Facade pattern

21

22 of 48

22

Original embed��993kb

<lite-youtube>��47kb (-95%)

23 of 48

23

Original embed��993kb

<lite-youtube>��47kb (-95%)

24 of 48

Dark mode and OLED

24

25 of 48

25

Light theme��11W

Dark theme��4.3W (-60%)

26 of 48

26

Light theme��11W

Dark theme��4.3W (-60%)

27 of 48

27

Source: my measurements: OLED power consumption, 13” OLED

28 of 48

Image optimizations

28

29 of 48

29

Original JPEG�196kb

Jpegli�132kb (-33%)

AVIF�48kb (-76%)

30 of 48

30

Original JPEG�196kb

Jpegli�132kb (-33%)

AVIF�48kb (-76%)

31 of 48

Modern image formats and encoders

In Django: django-imagekit, django-pictures, Wagtail’s {% picture %} tag

{% picture my_img format-{avif,jpeg} width-1024 %}

31

32 of 48

Example: PSF 2023 annual report

  • Original PDF: 16MB
  • Simpler HTML version: 6MB
  • Jpegli-optimized version: 2.5MB
  • AVIF-optimized version: 1.6MB (10x lower!)

32

33 of 48

Responsive images

33

Original PNG�(1280x800)��40kb

Max display size�868x543��36kb (-10%)

Mobile display size�285x178��9kb (-78%)

34 of 48

Responsive images

  • In HTML: <picture>, srcset attribute on <img>
    • Read: MDN - Responsive images
  • In Django: django-imagekit, django-pictures, Wagtail’s {% picture %} tag

{% picture my_img format-{avif,jpeg} width-{400,800} sizes="80vw" %}

<picture>

<source srcset="400.avif 400w, 800.avif 800w" type="image/avif" sizes="80vw">

<img srcset="400.jpg 400w, 800.jpg 800w" src="400.jpg" alt="A Wagtail" width="400" height="300" sizes="80vw">

</picture>

34

35 of 48

35

36 of 48

1,858

Example: Wagtail

36

tCO2e/year reduction (30%) in carbon emissions��once existing Wagtail websites implement those improvements

37 of 48

Site architecture

37

38 of 48

38

39 of 48

Carbon emissions of a Torchbox website

  • Django server: 50-100 kgCO2e/year
  • Database: 109.7 kg
  • Cache: 52.6 kg
  • File storage: 3 kg

39

40 of 48

FaaS

40

41 of 48

Data center regions

And their grid carbon intensity

41

42 of 48

42

43 of 48

Data center grid carbon intensity by region

  • Google us-east1 (South Carolina): 560 gCO2eq/kWh
  • Google us-west1 (Oregon): 94 g (-84%)
  • Google northamerica-northeast1 (Montréal): 2 g (280x lower!)

43

44 of 48

44

Source: Boris Gamazayichikov (Salesforce) - Green Web Foundation report

45 of 48

Taking this forward

45

46 of 48

Get climate action started at your workplace

Getting started:

Going further:

46

47 of 48

Thank you!

Let’s work on this together at the sprints?

47

48 of 48