Greening Digital With Django
Published July 10, 2024
This video features Chris Adams at DjangoCon Europe 2024 in Vigo, Spain.
Workshop: Greening Digital - how to set up your django app with green coding metrics in CI by Chris Adams
https://pretalx.evolutio.pt/djangocon-europe-2024/talk/ZP9RWD/
Digital services create emissions through both the electricity used by devices, networks and data centres and the energy and materials involved in making hardware and infrastructure. Because organizations are increasingly expected to report environmental impacts, developers should help measure and reduce them, while treating results as estimates: available models rely on incomplete data and different tools make different assumptions. Adams compares usage-based tools, which help developers test changes, with billing-based reporting, then demonstrates WebPageTest’s Carbon Control and Green Coding’s system-level benchmarks. These tools can help teams compare pages, workloads and architectural choices, track results over time, and explore ways to lower impact; the transcript cuts off during a question about how tools account for differences such as hardware and energy sources.
Summarised automatically from the transcript.
Automatically transcribed, so expect mistakes in names and technical terms.
Speaker 1: Hi folks, come in, take a seat. Dear ops and A D people, should I just be waiting or is that okay for should I start now? I can start, yeah. Folks, shall I start?
Speaker 1: Okay. Enthusiastic nods. All right, that works. Okay then. Thank you. Thanks everyone for turning up. As you might see, assuming you can read, this is what I think we're going to be running through for the next 45 minutes I realise that it's the third day of a exhausting conference and I am doing the slot just before lunch, so you may be hungry and as a result I'm not going to try to work you too hard So the description on this has all this cool stuff, but I'm gonna start with something a bit easier, first of all. Alright So just quickly before I start, how many people saw my talk a couple of days ago Alright, so most about half the people saw my talk for this.
Speaker 1: Alright, I'll skip over this, but the short version is I do a lot I I've been working with Django for a while and I've Pri primarily focused on climate and data startup for the last 15 years of my life. Alright? Okay, housekeeping. This is what I'm going to try and get done in the 45 minutes that we have. So these are things I'm expecting you to this thing that it would be useful to have for this. Now, if you don't have this, you it's not the end of the world because we can follow along with some of this, but you might get more out of it if you've got a laptop to play with and try some of these things out. All right. And also Well, I just it says you need a GitHub account, but I figure that's a relatively safe assumption a lot of the time for professional developers these days.
Speaker 1: This is what I think we're going to try and get done. I'm going to talk to you a little bit about how emissions result as a result of us using digital services. I'm going to talk a little bit about how people use these things and then hopefully because most of you already know some form of Django Fu, I figure it would be useful for you to see how some of those skills uh and some of that investment of your career may be useful for this kind of stuff as well. So let's so before I go any further This deck is online at this URL here. I will share some links to it for you to access from a laptop a little bit later. But if there's one thing I'd ask you to do, if you can take a photo of this page here and then help me understand what you're here for.
Speaker 1: That'd be really, really helpful because this will basically be a link to a survey asking you, what is it that you want to actually know? And if there are things which I cannot cover today because I don't have the time, I will reply to you personally. uh with uh a lot of links and some kind of references. So if you if you put the effort in, I'll put the effort in back. Alright? Okay. Have you I'm not sure if many of you are familiar with the Green Web Foundation, but I'll just tell you a little bit about what we do. We're a nonprofit based in the Netherlands. We're working towards a fossil-free internet by 2030. We've been around for about 15 years and previously we were tracking the transition of the internet using various tools. Now we are trying to accelerate this transition of the internet by empowering
Speaker 1: developers. and people like yourself to help move that faster. So we have various checking tools. If you go to our website at thegreenweb foundation. org You'll see a way to kind of check any domain to see if it's running on green energy. We also publish open source tools. One of the libraries is called CO2. js, but we're not going to be talking too much about that today. But it is one of the things that the tools I'm showing you will be using. We also work with other organizations because we're relatively small ourselves. And by working with other people who are already established, we can help people who are well-meaning inside those organizations put say uh add environmental intelligence into some of their products So this is a pull request of us contributing code into Firefox
Speaker 1: that lets you do pretty cool stuff. So if you have Firefox on your machine, you can work out the environmental impact of pretty much anything you can do in the browser itself with huge amounts of like really, really nerdy detail, for example. And uh one of the thing we're doing with the thing I'm gonna show you for summer today is some of the work we did with catch point, or with web with web page test by catchpoint, which is basically one of the it's the the one of the reference web performance tools that is already used by lots of places and used by governments and things like that. We also do commercial service work. So if you're looking for commercial support or you're in a team and you want to figure out how this might fit into the stuff you're doing, we do make that available So that is one thing that I'm very happy to speak to any of you about afterwards, because it helps fund me doing things like this for free.
Speaker 1: So but first of all let's jump into what digital uh is and how it causes emissions and everything like that The short version, because I'd really like to get you to start being able to play with some of the tools we have here, is a bit like this Digital services come from kind of two two kind of main lines of activity. There's the usage, which is stuff at the top, like our laptops using electricity or uh the fact that you need to power networks, we the fact that you need to power data centers. So the energy will usually come from burning fossil fuels for the most part. And uh there's also energy associated with the making of devices because turning sand into silicon chips is incredibly energetically expensive. And uh we also expend significant amounts of energy to build the buildings to put the servers in
Speaker 1: and to build pretty much all the other bits of digital infrastructure that we kind of know about but we're told don't really exist because it's more like a cloud, right? So that's the kind of that that's how this comes about. Uh the other thing that I'll tell you is why we might care about this more is that there are laws which have been passed recently which now Compel large organizations to basically disclose how they're doing on environmental goals as well as financial goals. So I won't get I won't tell you too much about the specific laws, but the lit but the the page this this deck has a link to a page on our website with my previous talk where I went into a lot of detail about that kind of stuff. So what I want to do is give you a chance to figure out how people do estimate this stuff because over time
Speaker 1: developers like yourselves are going to be asked. What is this impact? Because we need to report everything now. We need to report travel. We need to report buildings. What about digital? Is there a carbon footprint from that? And as most of us know, the energy has to come from somewhere. The stuff has to come from somewhere to make devices. So People will start asking us and uh it's likely that if we don't take an active role in this The answers will be very, very wrong and might be might not be the answers that you'd like. Also, if you consider yourself a kind of responsible engineer, this is one way to kind of bring more of your values to work, I suppose, or deal with some of the kind of What's the word I'm after? The dissonance of working in an industry where a lot of the time we're we're doing things with cloud, but we know there's an environmental impact to a bunch of it.
Speaker 1: The thing I'm also going to share with you is that this is a kind of developing field. Alright. So I'm going to show you some tools and they'll have like different ways of measuring stuff. And this is something that's being updated all the time. And this term I found this kind of phrase I found very, very helpful for this Of all models are wrong, some models are useful. It's useful when you're working with this stuff because a lot of the time we don't actually have access to enough of the information to make really precise, really certain uh calculations. So we often resort to using models a lot of the time. And that's what I'm going to introduce you to you you to be using. The other thing to bear in mind is that when you're trying to understand the environmental impact of digital services, there are two main ways of
Speaker 1: kind of buckets of tools. There's usage-based stuff, which will look at things that can be observed by your system, and they'll use that to convert that into, say, carbon figures. And there's billing-based figures, which look at the Well like as you'd imagine, the bill. And it will turn that into emissions data. Now there's plus points and minus points for the two of these, but it's quite useful to bear in mind because For developers, you're probably going to be doing things with usage-based stuff first to figure out how to change things. But when you have people asking for reporting, they're probably going to be looking at the billing-based stuff. And the good news is that we're getting more support for this. Platform. sh will give you a bill just like this now, every year, for your use, which I think is pretty cool.
Speaker 1: And if we look at these two buckets, we have kind of sub-buckets inside them. If you're looking at usage-based tools. There's things which look at say just a single component, like there might be a part of the browser that tells you what the browser is doing, or there might be the server showing what the server is doing And then there's a system view, which is more like we have a browser and we have a serve, we have these things together, let's take figures from all of this stuff so we can make some We can draw some conclusions from that. Then finally there's a kind of global view which basically looks at some of this stuff and says, well, what proportion of my use makes up the global footprint of all of the stuff and what share of it belongs to me. And that's some of the tools
Speaker 1: those are one of the tools some of the tools you'll probably first start with. The other thing to bear in mind is when you look at billing, there's native and third party. I'll explain these in a bit more detail. So usage, as I just mentioned It's stuff which is useful for you to see, like you might use perf or something on in a Python program or some kind of optimizer there. The system view stuff helps you do something a bit like a sit in integration test, and that's what we'll be looking at for some of today. There are some other tools which will give you kind of observability style data. So if you've used anything like Grafana or Sentry or things like that. There are now tools which expose which which share some of that. And then finally the global view stuff is what I'll show we'll probably look at first. These are some of the tools that you might play with.
Speaker 1: We're going to look at one or two of these. The ones I've shown here are ones which are kind of Pythonic or easy to start with, basically. Now on the billing front, I spoke about there being two kinds of options you might have there. There are native ones, which are primarily from the providers, the vendors of the services you're purchasing, and there's third-party ones which are from people who are not your vendor not the vendors and might have slightly different models which could which come up with slightly different numbers. And one of the reasons for this is that Every single provider has a slightly different way of reporting their figures. So if you have multiple clouds or you're using multiple services, it may be useful for you to look at some of the third-party options. Basically all the big clouds have this stuff, but as I mentioned before, they leave out certain things
Speaker 1: or they have different ways of measuring. Amazon's customer footprint tool is unfortunately leaving out the part which makes up 80% of emissions. So it's going to give you very, very low numbers. Which will seem way, way lower than the other ones, but that's because you're not seeing the full picture. At which point you might want to think about the other third-party tools on the right-hand side, for example. But we're not going to be talking too much about billing stuff. We're going to be talking about things we can try out and use. So these things in yellow, they're the stuff I think that if you were coming to this for the first time and you had a bit of time for the sprints I would recommend you start playing around with or try out. And I'm going to show you how some of these will work and what they look like to use. So show of hands, who has used a website carbon calculator here
Speaker 1: before? We have two people out of our uh group of 30 or so. That's well 20, 20, 30. All right, this is good. This means it's new and you'll and you will learn something very quickly. So this is website carbon, which was like, as you can see, the original calculator. This has been going for about, I think, six, seven years now. What it does, it looks at a website, looks at how big the page is, and then it will give you some figures for the carbon footprint of this. And it will also look at which websites it loads resources from Which of those use green hosting or if the website itself uses green hosting? So they use the data set that we've been maintaining for the last 15 years. There's another tool which I mentioned, Web Page Test.
Speaker 1: This uses the same dataset that we publish every day, but it also uses CO2JS, that library, because that makes things a bit easier and a bit more consistent for people to use. And I'll show you what this stuff looks like in a bit more detail. So I see a few people with the laptops out. And you can try it out yourself by just going to webpagetest. org. I'll give you a bit of time to have a look at that. And then when you're there, there are two things you can do. You can try a test. If you go to the web page test page, There'll be an option to do something like this and then you'll need to check this option which says
Speaker 1: uh run carbon control. All right I'm just going to wait here for someone to have a look. And then if someone would raise their hand when they've got to this point and they've started a test, then I can show you some of this. I don't know if you can do it on a mobile, actually. That's a very good point. Uh because I see uh sorry, I forgot your name, but that's uh I see people using it on a mobile uh it may be something you can try from a mobile. So you'll see there's a number of settings here to simulate where you might be from or what kind of browser you might be using because these will have an impact. If you really want, you can dive into loads of detail as well. Because there are lots and lots of different kinds of contexts that you might be using digital services in. So if you want to do this and look at the advanced version, you can choose your browser, like Chrome, Firefox, something like that
Speaker 1: Um and then you can run the test like that. And uh I'll just give you a bit of a second to give that a go. I don't see any I'm not able to see any notifications. So if there's any questions or things come up, you'll just let me know, yeah? Okay So this usually runs on a queue, so it may be the case that you've submitted something and it will take a little while to run through this So this is what you should see. It should look a little bit like this. And then there'll be a drop-down showing all these things like performance, film strip, blah, blah, blah, blah, blah. Carbon control is the thing you might care about here. And uh you can see it will show you something that looks a bit like this. This is checking our own website.
Speaker 1: And uh you'll see that yes, we're running on green energy. And you can see that there's a number of domains we're getting things from. You can see how big our page is, and you can see the modelled impact of loading that page one time. And if you click on the button there on the screen that you see, you can see which ones are hosted green and which ones are not. So this will give you a thing that you can then That's a really really easy thing to change to to look at for example or give you a chance to kind of have a conversation with a vendor or see what their options are or even if you want to get a full green thing uh a full green list, see what options you might have. Because more and more providers are switching over now
Speaker 1: for a number of reasons, not just the legal reasons. As you can see, this is the carbon footprint. Now web page test assumes there is no caching taking place, so it's a first load. This is why, one of the reasons why we've created a library to make it easy to come up with various other scenarios that might more accurately represent people using your site, for example. You can also see some things that you might do to improve stuff. So you don't need to be a specialist in this. You just get some helpful prompts that you might have here. And uh
Speaker 1: Okay. How about that? Is this working Is anybody there? Yeah. Hazza. All right. Okay. Where were we? Going back into this. Alright, so you can see some of this stuff. And this gives you something you can start playing around with. uh for your personal projects or cron jobs or have things tied to commits or pull requests and stuff like that. There's quite a lot of people doing things in this field right now. If you want to know more about using WebPayTest, because I bowreled through this quite quickly, we've got some links in the deck. The second one gives you a lot of detail about how to use WebPayTest.
Speaker 1: You can see the source code, you can see the specific code in carbon control to figure out how that part works. And our website has a series of case studies where we showed how we actually worked with these people and why they did some of this stuff. Finally, if you don't want to run a test yourself, I can show you one of these tests. This is the one that I looked, I did for the DjangoCon website, right? So you can see this here. And uh we can see that okay, the good news is we've got green websites here. It's quite a large website, all right. It's it's uh in the top thousand, right? It's uh so it's quite a bit larger than the average basically. So this is what this is one thing that you can actually see straight away to fix has it broken again?
Speaker 2: The audio is okay
Speaker 1: We're not seeing this. Okay. Showing my entire screen. Alright. Stop sharing your screen. Start sharing my screen. Okay, entire thing here. Alright. So I think it might be when I press this, people might not be able to see it, right? Okay, so for folks who aren't here oh no hang on maybe they can see that. Can you tell me if you can see the screen see the screen when I click on share slideshow like this? Is that what breaks it? I don't know if he's checking or if you can hear me. Yeah, okay. All right.
Speaker 1: Yeah. Okay. I am just going to so it is working, is it? Okay. So this gives you one example. This is one that you can play with straight away. This is something you can leave this room because it's a bit tiring in a set day and you've got something to start with straight away. Now, like I mentioned, this is using CO2. js, so you can see the code, see what's happening. It's using our dataset. This is what you call a usage-based global view tool. Now you'll notice that there's maybe some issues here because you might ask yourself, can I really make all these assumptions based on just what I'm sending over the wire? And personally I think no, you probably do want to use some other tools. But it's also worth bearing in mind how much of an effort you want to
Speaker 1: you want to invest in this new field to start with. So I think that having something like this to give you some numbers at least helps you start iterating and improving some of this. Especially because A lot of the reasons we are struggling to get numbers is because large companies are not very forthcoming in sharing the information that makes some of this possible. I'm also sharing a link here to my colleague Fershab Nurani uh Irani. He's gone into a load of detail about this and some of the trade-offs you might look at. And it's really, really worth looking at if you're curious about this and the other approaches people take. I spoke about this being a new field and there's work taking place. There is actually a standard that has been announced this year. called Software Carbon Intensity
Speaker 1: by the Green Software Foundation. So this is an ISO standard. It's free for you to look at. It's developed in the open on GitHub. So if you wanted to actually Look at how people are trying to arrive at decisions about this stuff, that's what they have. And uh one of the key things that's different with the software carved intensity spec is that it's not just for web pages. You can use it for a number of different things. So we've looked at say page requests right now, but You could do it for a CI run, you could do it for an LLM query, all these things here, because we don't just use browsers to access digital services these days. And uh this is basically this slide they use to kind of communicate what this is. They talk about the stuff on the left in the brackets.
Speaker 1: So everything inside the grey brackets is basically carbon R is the per thing, like per web page, per LN lookup, or something like that. And I do apologize for every time every time every single time I look at this. It's a bit of an overwhelming slide, especially on day three of a conference when everyone's a bit tired. All right? So it might be a bit easy just to think CO2 per thing like that. That might be easy. It's basically the same thing. I've showed you web pages, but you can use you can do all kinds of other things. And there's one company that are based around the corner from our office called uh Green Green Coding Solutions. They launched this uh literally, I think Friday actually. And this is, I think, is pretty cool.
Speaker 1: We talk about the environmental footprint of AI. This is the first tool I've seen so far which lets you work out the carbon footprint of a particular question. So you can go to this website. choose a different model and then see ask and then see the environmental impact of asking that particular question. So let's say I'm here and I say I want to use the Mistral LLM because that's very common and very and really really powerful. I see I can ask him, what is DjangoCon EU? And I'll get some kind of description about what it is. It's something for this, people to use a bunch of these things about these patterns, blah blah blah. All right. And I can see the environmental impact from this, and I can see the software carbon intensity for each reply that we have here I can also see well
Speaker 1: can I improve that? Is this a reasonable kind of trade? Maybe I might want to use something smaller So this is one this is the same tool using a smaller model called Tiny Llama. And uh the question, the uh you're getting an answer back, it's slightly different, right? And it's a seventh of the resource usage that we have here. Now, I don't know about you, but I'm not sure the answer from Mr. was seven times better than that. And if I was gonna make a trade-off, this is like one really, really easy example to play around with to give you an idea of like, okay. There are all these different ways you can start optimizing for carbon and even make some of this visible. Now, it's taken a small company, a tiny, tiny startup, to share some of this stuff. But the fact that we have this shows that you can see this, and this is something that larger providers can do as well.
Speaker 1: So that's some of the ideas for the kind of tools you might use for this. I did speak a little bit about as a Django developer what you might use for yourself. And uh There's a whole if why we talk about this, we have like browsers at work, we have data, we have servers, and you might want to look at the full stack, the whole stack for this. Now this bit I'm not going to ask you to do too much with because it's a Friday and everyone's exhausted. But the thing I'll point you to is this project called greencoding. io So this is, in my view, one of the best open source tools for doing kind of exhaustive, quite detailed uh Calculations and models for the work that you actually have. And I'm going to show you how we used it last year with Wagtail
Speaker 1: to get some idea of what the environmental impact from using various flows through the website might actually be Now going back to like this taxonomy we said, it's a usage-based tool, so there's no bidding involved, you don't need billing data, and it looks at the system, so it's using your browser looking at your browser. and a server and whatever other services you might have running inside this. And it kind of creates a kind of model of what you have working here. It works a bit like this, so it uses Docker to set up a Docker Compose to Dockerise various components that you have in your project. And then it looks at the metrics coming from each of these as they self-report their own energy impact. And uh This is quite helpful because it allows you to try different kinds of scenarios and try different things.
Speaker 1: So just like we looked at before, like Does it make a difference if I use a different model? You can say, well, does it make sense for me to build something in a kind of like static compiling fashion? And how much better is it, for example? And uh this is like one example where you might compare. Serving a site over a dynamic thing with wo with WordPress, should it make is it better for me to use maybe a static one? And how much better? Can I seek this stuff And like the short version is, if you're using some of these tools, the answer is almost almost always yes, then you probably had the intuition anyway. But this would give you some ways that you can see the actual numbers for this, which is, in my view, something that we haven't really had that much access to before. And it also means that if you're looking at this, if you know you built something once, then maybe that would make it a candidate candidate to make this a serverless thing, which you then
Speaker 1: have it have it build once and then you just move over to just serving static files, for example. So this helps you think about different architectural choices you might make as a developer or as a kind of designer of a system to reject to make reductions. If we would look at doing this in Django, you need two things basically. You kind of need a Dockerized application first And uh you need some way to drive a browser, just like you mentioned, to get this detail for some of these extra these these points here. Now, I I know better than to try to get people to do this with their own project in 25 minutes or something like that So I'll show you what we did with Webtail. All right. Webtail is a really good use case for this because they have something called the Bakery demo
Speaker 1: where you can Basically check out a kind of pre-configured version of the Wagtail CMS with some dummy data and some dummy images. And then you can you can kind of have a go and play play around with it. And this is designed to be somewhat representative of a real site. And if you're using tools like green metric coding, you can basically run these various scenarios and then you can see things like the software carbon intensity figure here. So we're starting to see some kind of somewhat sensible and like repeatable ways of looking at the impact the things we'll be doing. And moreover, we can see this on a schedule. If we run it on a schedule like a cron job or anything like that, you can see how this is tracked. And this is currently public. One of the lovely things about open source tools is that you can do this stuff and you can see what these numbers might actually be.
Speaker 1: Also, because it's open source, maybe one of us might want to provide a pull request to move away from nanograms per page request or something like that because this is a strange talking about things in terms of 20,000 nanograms versus Point two, I find it a bit complicated and hard to kind of get my head around. But yeah, this is this is what it is basically. So We could try doing some of this mys ourselves, but I said I'm just going to run through the steps that you would use rather than ask people to do this themselves. All right. This is what we would need to do to run through this. I've created a pre-prepared repo on GitHub. You'll be able to kind of check this out and then using Docker Compose spin up an equivalent to this. You can then try some of the end-to-end tests to kind of see what they look like.
Speaker 1: You then see how they show up in a kind of YAML file which describes these steps where you can define pretty much any kind of interaction that you can script using playwright, puppeteer, or whatever you want. We're then going to show how you would notify a hosted service rather than having to run it yourself, because mainly because it's a bit easier to do it than having to run this stuff yourself. And then if you do want to self-host this, I will show you some of it, but I'm not sure if we're gonna have enough time to show you that because I'll be honest it's quite complicated to get that set up because you're basically running a thing that runs Docker containers in a Docker container. And there are screenshots, but I wouldn't expect anyone to get it done in the time we have available. So you can go here, this project, it's Bakery Gold Benchmark, and then follow the steps here.
Speaker 1: And uh this is pretty much it. I've shared the link to you and you can I was I was trying these last night and this morning, so I know that these should work on an Apple Mac. They should also work on things which aren't Apple Macs as well. So let's run through it. It would look a little bit like this. You might check out your uh the the project. You'd run Docker compose build to fetch all your files and things like that. You'd run Docker Compose up to get the various components running. So you have a system which is a little bit like under test. Now there's some steps here that you want to run migrations and load some dummy data in. So this feels like a kind of representative version of a site. And because we want to make something that feels like a real production site or at least be more accurate to how people do do really use it, we'd like to warm up the cache.
Speaker 1: So you can see a line here where we just Hit this as hard as we can or hit a bunch of things to kind of trigger the caching of a bunch of images to be set up locally. And then once we've done that, we can access it at localhost here Uh what we have now, and I can show you some of that actually. So with this running locally here, I might run Docker Compose here, spin these up, blah blah blah, all these things are running here. And then if I go to This webpage here is I've got this working. So I've now got something which looks like a real version of a website, for example. Okay Now let's go back to the end-to-end tests that we have here. Now I said that you can drive any kind of interaction that you can put in a kind of Docker container, basically.
Speaker 1: So This what we have here is we have some JavaScript files which are driving Puppeteer which is a was one of the what was basically one of the nicest tools to use before playwright basically become the thing that people lots and lots of people use And as you can see, we have some scenarios which simulate someone using a website in a kind of somewhat realistic fashion, basically. We can do this locally. So if we were to check this out ourselves, we'd run an NPM install and then run this like this. So if I'm gonna do this on my machine. I've got Docker container, I've got a uh Docker running now. I would basically run this. So I could copy and paste this, but because this should be in my history, I would just run it like so.
Speaker 1: And this should spin up a browser, visit a page, try and fill it in. Come on, yep, fill all the stuff and then it will show me that stuff. So this is like me working and seeing what some sort exercising the functionality to see what might have to happen at a database level or something like that And then you'll see like what we've got here. There's a thing we've noticed here, SEIR, which is basically how we count up the carbon footprint because we've looked at two pages, for example. So that's kind of what we have here. And this is an example of you of using some of these tools. All right. And to answer your question. You can script anything that you can run Puppeteer, or anything that you can run in a container.
Speaker 1: It doesn't even need to be this. So anything that can hit an endpoint or running server, you can use to simulate this. So there are examples of using JMeter or things for load testing if you've got a service that gets a lot of traffic. There's things like that. And then once you've done this, because what you might want to do is rather is actually see well what do these numbers look like, right There's a part of this project where you can basically send a request to a hosted service for a public piece of code for this. You can also manually submit a link to this, so you can kind of fill out a form, but this is the kind of Pythonic way And the code basically that we have here, which says like register for run with GNT, basically looks a little bit like this.
Speaker 1: We point to, we name our project. We pass a name that we'd like, an email address that we'd like a notification to be sent to. We then point to an open repository for this You tell the branch that it is. We talk about the scenario that we're trying to run, because there may be different scenarios you want to be checking out. Now Seven is basically a one of the machines which is set up for benchmarking. When you're using the form, it's easier to see that. And then you'll schedule this to have this as a one-off. For at the moment, they have a fair use policy, so you could get this run on a daily basis or things like that. But for the purpose of playing around with this this weekend, you might want to just try it once. And then that will be sent along, a a run will take place, and then you'll get a new notification showing you some of the stats that you have here.
Speaker 1: And then if you visit the page that in that is in that email link, you'll see the kind of steps that we might have inside a scenario. I'm going to a contact us page, I'm visiting this, I'm filtering, I'm doing this kind of stuff. We'll also show some other things like running migrations and things so you can see what these numbers might be. And then if you scroll further down, you'll see where the impact might be for this. And uh you'll also see the figures for software carbon intensity that have been listed here. So you've got these numbers here, you've got it on a per page request level, and you know that R thing I showed you before This set of different scenarios, it's about 30 page requests. So they divide it a bit like that. And the maths is, I think, is a bit I think it's 14 page page loads. for the different scenarios that you have.
Speaker 1: And uh you can basically your mind you're you you would come up with different scenarios depending on what fits your particular context. And then I mentioned if you were to go to the metrics page, there's a link that shows energy timeline and you can see projects that are currently doing this stuff. Now we currently have one for the If we go to metrics there, you'll see that there's a bunch of different projects that are running like this. So there's the Django project. You can see the impact for every single CI run. We can see the benchmark thing we're looking at before. If you want to look at a database, there's various other benchmarks that are being run. So it kind of demonstrates that there's quite a lot of versatility that you actually have here
Speaker 1: So this is how you can start to use some of the existing tools and the existing knowledge to start generating some numbers that you can track over time and improve and optimize basically and set targets around So this is what I was mainly going to try and show you, which was basically how carbon emissions result from the use of digital services, how you might try measuring some of this. I also showed you a little bit about how some of the existing tools in Django Land can be useful for this. And while I've shown you Puppeteer being used. I'm pretty sure it's not massive leap to think about how else you might use this. We have like play playwright. py, for example, or things like that. If you're more comfortable using those kind of tools and you already have some integration tests, You can use this to start looking at some of the scenarios that you might actually have and think about trying to
Speaker 1: optimize them from there. And yeah, thanks folks. That's what we have so far. Please do take a second to go visit this URL, which basically allows me to see if I did okay, if you understood any of this, if this has been helpful for you. This is how to be in get in touch with me. This is where I am online If you found this interesting, there is a community called climateaction. tech, which I have been part of for two since 2018 and has been really helpful for me understanding this kind of stuff I also am in a position where I get to record interviews with people who are working in this area. So if you would like to learn more about this. The people who build these tools, I do my best to speak to all the academics and the professors who work in this. I try my best to make this stuff visible and accessible to as many people as possible.
Speaker 1: Then finally, if you think this is interesting, there is a magazine called Branch, which also talks about this stuff, where people who are building these tools or trying to take their first steps into this field write about their experiences for the first time and how they're getting on with it. And yeah, that's pretty much it. I'll leave this for here because uh I think we're coming up to five minutes away from lunch. While I could show you a bunch of other stuff, I suspect you might appreciate having five minutes time back, basically. So yeah, thanks folks. All right, just a quick one. There is loads more. If you do want to run GMT, we've got like a bunch of stuff about how to set it up yourself. We also have stuff about how to use a Firefox profiler.
Speaker 1: There's even a video showing how to do all this stuff. There's a bunch of cool stuff that you actually have available as well. So if you do want to look at this stuff, there's loads more. And if you're curious about CO2. js, we've also spoken about that as well. So with this link, you've got loads to play around with. All right. So that's the last thing I have. We've got a bit of time for questions. So if anyone has any questions, I'm very happy to ask, answer them Uh before food. Yes.
Speaker 3: website because on one website I have one number on on another website I have another number. Like yeah and because also how do you detect Because you can run the different skills like ARM SKUs consumes smaller amount of energy and classical ones it is
Speaker 1: there is I think I know you
Speaker 3: can use the water power sensor the energy like like may might have different sources like the cleaner one and one how do you detect all this complexity
Speaker 1: so the our our our position is that if you want to do this you need to have as much openness as possible so that you can actually challenge these assumptions all the way through So that's one thing. Um I think it's also worth bearing in mind that you can go more and more detail depending on how far you want to go down this. So the reason I pointed to the use of a hosted service. is because that lets you choose maybe an Intel machine or another machine that might be more representative. Or if because this is open, you can run this on maybe an ARM machine yourself or you can have options like that. Now not everyone does want to do that. So There's a decision about how far down these rabbit holes you want to go yourself. Because even just inside a single computer, there's questions about, okay. Do we want to switch on the fact that a CPU can burst or not burst?
Speaker 1: There's all these things. And uh this is why we try to work with open source tooling as much as possible so you can make these configurations and make some of these changes. And in the run-up to this, that's literally the stuff that we had to do to make some of this available. So I would really recommend you check out the green hosting page. Sorry, the the green hosting. io thing. They go into so much detail about this stuff. And uh their blog is fantastic for this. So I think these folks here. They talk all about the things they've been learning. uh what differences you're gonna make, uh basically how to figure out these things. So there's a load of things like that that they share. I hope that gives you some answer some some points for this. Because
Speaker 1: Yeah, there's uh there there 's like an ocean of complexity ahead of us and the only way we can work with this is modeling some of it as we work through it.
Speaker 3: Like if we run all the tools about getting access from their clients, browsers, then we somehow violate the privacy of the users getting the like about like how what kind of the group are they using or what kind of skew what are they gap at the moment.
Speaker 1: Yeah this is this is why we work with Ms. So the question was about what about the privacy implications of doing this stuff, right? We've been working with Firefox specifically because they were bringing up these issues and because we want to work with an organization that has probably a slightly better track record on privacy than some other browser manufacturers or people like that, right? So to show that you can do this and uh that that you can actually start with some of these uh these defaults. But you're right, this is totally an issue that we need to be aware of Because uh yeah, you can disclose a bunch of information about this. And uh there are some cases when you're working on a server that the visibility that you might actually have into a machine can actually be seen as a a vector uh and a uh a an attack surface of sorts.
Speaker 1: There's an a the uh and uh I can share a link to a blog post about our us working with the Green Software Foundation specifically around that. Okay, are there any other questions from anyone else? Because if not, I'm happy to let you go.
Speaker 3: Oh yes at the back. short of new experiences regarding the front end. What has the highest impact to reduce the footprint? JavaScript, CSS.
Speaker 1: We s we can figure we can see some of this stuff now with um the browser stuff we did. Like by putting this in into the f into the Firefox browser. Uh we were looking at this stuff and the broad what we're seeing so far is that JavaScript tends to kind of JavaScript has a higher impact than say images, for example. However When you're looking at things like video, for example, because a lot of computers now offload that onto a dedicated machine, dedicated chip. That might not be the imp as impactful as we were thinking about before. So it's a lot of the ideas that you already have about what is bad for performance or jank actually kind of is quite transferable to these discussions you have right now. All right. Okay, I think that's uh lunchtime.
Speaker 1: So folks, please do if you can, take the time to give me the feedback uh for this because it makes it easier for me to justify this to the people I work with. about why I'm going spending five days going to a c to a conference by train to talk about this stuff. And yeah, thank you for coming in and talk and showing an interest in this. It's it's actually reassuring. All right, cheers folks.
Emissions come both from electricity used by devices, networks, and data centers, and from manufacturing the equipment and building the infrastructure they rely on.
Discussed at 5:32Run a test at WebPageTest.org and enable Carbon Control. It reports a modeled impact for a page load, page size, and whether the site and resource domains use green hosting; the estimate assumes a first load without caching.
Discussed at 13:27Yes. The Software Carbon Intensity specification can be applied to different units of software activity, such as a CI run or an LLM query, as well as a web-page request.
Discussed at 22:24Dockerize the app and use browser-driven end-to-end scenarios to exercise representative flows; the tool gathers energy metrics from the system components and reports software carbon intensity. You can run scenarios locally or submit an open repository and scenario to the hosted service, then track results over time.
Discussed at 27:53Note: We understand that names change, people change, and bodies change. We respect each individual's journey and privacy. If you have any concerns about a video or need us to remove content, please don't hesitate to contact us. We will handle your request with care and promptly address any issues.
Published June 13, 2025
Published June 13, 2025
Published June 13, 2025
Published June 13, 2025
Published June 13, 2025
Published June 13, 2025