Greening Digital - how to set up your django app with green coding metrics
Published July 11, 2024
This video features Chris Adams at Django Day Copenhagen 2020 in Copenhagen, Denmark.
We’re in a climate emergency, and as the world goes digital, we run the risk from going from software eating the world, to software heating the world.
Chris Adams, from the Green Web Foundation and ClimateAction.tech will show how to quantify the emissions from the digital projects you work on, and how to make measurable differences, from optimising code, to thinking structurally about how you spend your time as a web professional.
Django Day Copenhagen 2020
Automatically transcribed, so expect mistakes in names and technical terms.
Speaker 1: Thank you very much, Django attendees, both in present and uh remotely over there. Hello, Internet. Uh I at first at Django as Ben at Django on Europe in Denmark last year and I was so charmed by this by the City and the web that I felt that actually done for a second time. All right, um just a little bit about myself. First of all, can you folks? Yeah, this room here. I think the people on the internet can hear me uh okay as well. So as uh Ben mentioned, my name is Chris Adams. I have a background working in wacky environmental data startups and have been doing so for the last say ten or fifteen years. And to give you an idea, oh let me just make sure I've checking the timer so I don't go run over. So LOCO2 was basically all about making it possible to book trains as easily as you book planes.
Speaker 1: And that's actually the service I use to get from Berlin to uh Copenhagen today. Uh Amy was another company I used to work at. Amy stands for, as you can see, Avoid Mass Extinction Engine. We managed to burn through ten million dollars of US VC funding trying to figure out how to sell services around carbon calculation. We learned lots of l lots of ways not to do it. And uh the nice thing that's useful for nice thing that's good now is that I'm able to kind of share those learnings with other people now that there's a kind of new kind of interest in climate, I suppose. These days I spend my time working on three main things. One of these is called Icebreaker One, which is all about m basically making it possible for either finance or insurance or various policymakers to have access to the data necessary to make kind of informed decisions around say policy.
Speaker 1: The other thing I do is I work with Spend Network. With Spend Network we basically provide analytics around public spending. So the $13 trillion dollars that are spent every year by the public sector We provide analytics and tools to help people get better value out of that. And in and in particular, we're doing some new work about working out the embedded emissions. carbon emissions in various kinds of expenditure. So policy makers can understand that stuff too. The other thing I do is I am a director of the GreenWeb Foundation. which as you can guess from the name is about making the green the web green. So these are the two ways to be in touch to get in touch with me. I am Mr. Chris Adams pretty much everywhere online So um during my time with you I'm going to cover a few things. These are the topics. I'm going to try and arm you with enough information.
Speaker 1: To help you start navigating this kind of somewhat confusing world of kind of climate, carbon emissions, and in the context of being a technologist. Because in many ways it's actually quite difficult to find uh some reliable reliable information. And when you do look at a lot of the kinds of say uh a lot of the writing, you can it you can f it it can be hard to figure out where you should be focusing your time. The other thing I'm going to do is I'm going to share with you a kind of mental model that I've been using or that I'm working on. And I'm sharing it as a kind of work in progress to get some feedback from you folks as well. So I can kind of improve it or see if it is a bit more kind of intuitive and easier to use so that you might apply some of this as a professional or technologist yourself. Then finally, I'm going to try and share with you a kind of
Speaker 1: I think a way to uh a kind of like a a na a narrative of as it were for technologists like ourselves to see where we might fit. into this kind of transition that needs to happen, uh, away from fossil fuels to something which is a lot more kind of climate compatible. And I share this with you because I see people oscillating between this sense of learned helplessness where people say I'm just a developer. I'm just doing what I can I I'm told. What can I do? Or people saying, I'm a developer, I'm gonna fix this. What coding skills should I learn? As if like this is a coding problem, not a much more complicated problem than that. So I'm going to try and share a framing with you, which I think is should be useful and I've found helpful when I've been thinking about my role as a technologist in the climate crisis
Speaker 1: So before I go too deep into this though, I want to try to limit the scope of this talk. So as you might have noticed, we're in the middle of a pandemic. Hello, people for uh who are not here today. Uh but what the as is Cartoon, which has been doing the rounds on social media shows, there are all these other crises unfolding too. from biodiversity to a uh to to a recession and things like that. And uh a lot of these are really, really terrifying too but I do not think I can address them in a keynote talk at a Django conference in Denmark. So I'm not going to try to do that and I'm going to focus on what we can do as professional tech professional technologists. So while I think it does matter about the decisions about where about what you eat, where you fly and all and all the lifestyle decisions, I'm not going to be talking too much about that
Speaker 1: And I'd request that we don't spend too much time on that because I think it's going to be a distraction from our role as prof our roles as professionals. So Oh, have we got two slides there? Yeah. Alright, so let's start with what I hope should be a really, really uncontroversial and blindingly obvious statement. And uh the thing I really want to kind of draw your attention to in particular is the last part, which is finding a path off of them Now it's loads of fun to geek out about things like say uh carbon removal or growing trees or things like that. And I've been guilty of this as well. Now the thing is I I'm going to share with you an analogy which I think is which I found useful because I think it I kind of have this mental model in my uh uh
Speaker 1: internally of um us uh like society as a patient in the in an ER room like emergency room and we're bleeding out right now if you think about all these other things they're good right they they feel a little bit like pumping blood into someone when what we really should be doing is stopping the bleeding in the first place. And I feel that when we don't talk about fossil fuels and their the role in society, it's like we're not talking about the fact that We're still bleeding out and we need to be doing something about that thing first. So this is why I'm sharing this blindingly obvious slide with you, because you'd be amazed how much money and attention is being focused on things which are not about getting off fossil fuels. Now these this these words here, rapid, far-reaching, unprecedented, these are the like word for
Speaker 1: word from the IPCC reports. And uh the sheer scale of the changes are daunting, yes. And it's worth remembering that the scientists who have been spending years looking into this stuff are using phrases like this because IPC scientists tend to be very, very conservative in their recommendations. And when they are using these kinds of words, that's equivalent to them jumping onto the desk. grabbing us by the ears and screaming in our faces to get our acts together and stop accelerating towards that iceberg. So rapid, far reaching, unprecedented. I think it's really, really useful to remember these words and use them as a kind of test For when you see people talking about the next thing that will kind of save us on a planetary scale. If the things that companies are announcing are not rapid, far-reaching, and unprecedented, then maybe
Speaker 1: we should be aiming higher Now, uh, let's think about this. So what would uh rapid, far-reaching, and unprecedented mean to the for the internet for us, right? Um there's one thing I can think of immediately and it's in huge letters on the screen. And uh I think this is because right now every time we use the internet and we are professionals, I assume, who our job livelihood and our jobs and well you know um we spend a lot of time outside of our work as uh people using the internet we end up contributing to climate change whether we like it or not And you can make the argument that yes, pretty much every kind of economic activity also contributes to climate change. But this one really feels a lot more solvable than most, especially when you look at the last ten years of how our our use of the internet has changed.
Speaker 1: Now I um I'm sharing some charts now with you because I think it's useful to get some context and help address some of the kind of scare stories around the internet uh and like the use of like technology I suppose in the carbon footprint of this. Now it's generally quite safe to think of It's kind of t uh like the tech industry and uh data centers and the internet are at around like one to two percent of global emissions. So that's roughly the same kind of ballpark as all of shipping or all of or most of aviation now, or Canada, or Germany. So it's that kind of figure. So it's not small, but it's it's it's it's actually It's it's hasn't been growing as fast as other industries. Alright? And uh there's that there's some reasons for that.
Speaker 1: One reason is that We've basically seen that uh we've there 's been a lot of investment in actually making things get get better in in efficiency. But I also kind of kind of put to you that If i if you think about kind of things that are kind of civil like kind of civilization scale, right? One to two percent of global emissions for all the goods and all the kind of utility we get out of that I reckon that's a relatively good deal, even though we need to get down to zero. Like for comparison, we've seen in the last ten years, like say just the increase in emissions from SUVs. That's like more than two internets worth of CO2 emissions. And I've got to ask yourself, like, what would you rather have? Two internets or more SUVs in the last 10 years? Right? Like this is what this is why when we talk about this stuff, we need to have some kind of context here.
Speaker 1: And uh it's worth thinking about uh the shifts in the industry though and how that's affected how we work. All right. The efficiency, uh the way that we've managed to kind of kind of rein in this in growth, even though we've seen massive increases in use, is largely because we've seen a shift from running, say, trad working in traditional data centers to working with hyperscale or cloud services in many ways. So we've seen this consolidation amongst the big provide big providers at the expense of much, much smaller uh data centers. And uh you've seen the same thing at the network level now as well. So Cloudflare, Amazon and Google, loads of traffic is basically going through a number of small companies, a small number of very, very large companies rather than this whole kind of kind of more uh decentralized uh
Speaker 1: system of uh that that would that we've we've had over the last ten years. And uh I'd kind of say that when people start talking about like the internet and data and stuff like that, I don't think the problem is that we're using power I think the problem is that when we use any of this stuff, it ends up emitting carbon and that means we end up uh burning fossil fuels for this. And uh I'm so that's like the thing I really want you to be aware of. Now I'm just going to share a few kind of other concepts which I think are quite useful to give you some kind of words and I'm hoping there are some kind of database nerds who've got the MBCC joke here, right? But uh I mean we're Postgres friends, right? Okay. So uh I'm gonna share two sets of ideas which I think should be useful for you. So the first thing is to think about carbon emissions and how to think about it.
Speaker 1: If there are basically established ways to uh talk about and measure and kind of optimize the emissions of any organization or even a country or even like I guess going down, people, but really it's much more at the organizational scale that we'd probably w want to do something with it There's like a scopes and I use the medium of coffee because that seems to be a subject close to many year developer's heart. And you can think of it like this. So scope one, this is uh emissions from burning fossil fuels yourself. If you have gas at home and you heat up a kettle, that's your scope one emissions. Now scope two would be using a kettle, someone else is burning fossil fuels for you and you are benefiting from the electricity. So that's kind of your scope two. Now scope three is the entire supply chain.
Speaker 1: That's like you walking into your favorite third wave coffee shop and all the things involved in actually create making it possible for you to have coffee. That's just scope three. So that's your supply chain Now, we can make this a bit more concrete by looking at some organizations, some companies you might have heard of, see what their scope one, two, and three figures look like. So this is Stripe. Show of hands for people who are not who are in the room, who've who 's heard of or used Stripe. Okay, so good. All right. It's a company that you've you're aware of and many of us might look up to as people who are really, really good at doing a certain run running digital services. So their scope one is pretty small because they basically just run bits it's just heat building. Scope two is yeah, they probably need to have turned lights on rather than working in the dark sometimes. But scope three is probably the big thing for them
Speaker 1: because they are massive customers of AWS and Google Cloud and people like that. So that's probably where they're gonna have the most impact if they're gonna make any changes. And uh also uh employ employee community because that's g that's a significant chunk. Probably one of the biggest ones we've seen a change in over the last six months or nine months now. And uh yeah flying because that's incredibly that tends it tends to be quite an impactful one as well. How about Amazon, for example? Amazon actually has quite large scope everything really because they're just so huge. I mean uh yeah as you can see, this is uh two years ago, and this is a carbon footprint of Finland. and uh they've only been growing. So scope one, Amazon literally have their own air airline. So they're gonna be burning a lot of fossil fuels themselves. They also run a lot of service.
Speaker 1: They own about own about a third of the cloud market. So that's going to be quite large too. And because they have so many deliveries, or so many who with Prime, uh the lion's share is probably going to be from scope three from then Which is why they why them investing in things like electric vans is actually quite an important thing because that's probably gonna be where you're gonna see some some impact on this. Now if you are Google's another example. Google don't really ship that many physical products, but they ship information and they use loads and loads and loads and loads of service. And the graph on the left hand side here shows basically Google's growth in emissions over the last, say, well, last few years. And uh you'll see the on the right hand side Uh if we only looked at the power they pull out of the grid, because you do not control uh
Speaker 1: if you're connecting to the grid where the power comes from, you'd see what their missions would look like this. But because they've been investing, they are literally the largest corporate investor in renewable power. Their emissions are not being somewhat lower and we 'll explain that a little bit later. But this gives you an idea for how you might use these. Now Yes, if you are interested in about this or you work at a company which might have uh ever you might have these kind of conversations yourself, literally across the other side of the city, there's a company called Tomorrow. And they are building tools like this that you can use and try out. And these are really, really cool people. They're also hiring. But and uh I I think that it's worth looking at this stuff here because they figured out that you can actually work out these numbers inside an organization based on activity data in terms of like the kind of spending that you might actually do.
Speaker 1: We use similar models and similar approaches for spend network when we're trying to understand the carbon footprint of say a hundred million euros of public spending, but it scales down at an organizational level. And there's a number of companies that are doing this. But these folks are in the same city as you and they're looking for beta testers. So I'd really recommend speaking to them. So this is like how you might apply this yourself if this is has you kind of interested and you're trying to figure out where you might want to focus first inside an organization. Now I think is it taking a while to Yeah, there we are. Now I'm going to share a little bit about understanding energy markets or just enough for you as developers to understand some of the cost structure which affects the bills that you might be responsible for choosing as a developer yourselves. Alright? And uh
Speaker 1: this is one stack one level down the stack, but I'm hoping by the end of it you'll understand why I'm sharing some of this with you So hopefully some of this should be kind of something that you might be able to recognize yourselves. It's really good having two sets of people to speak to. Hello there, I haven't forgot you. Right? It's if you think about like uh how you might say buy buy services for any kind of uh digital digital like application or something. You might have things like say bare metal servers, you're familiar with these. Like this is the stuff that you think we usually use or we used to use maybe ten years ago. A lot of us might have shifted to virtual private servers where we accept a slightly higher cost. because it's just easier to handle. And then some of us like uh use things like Heroku where you literally have a slider telling you w which lets you handle scaling rather than you have to remember how to do this stuff or run Ansible or something like that
Speaker 1: Then finally at the other end of the scale, you've got things like functions as a service now, where, to an extent, the scaling is built into the system where you are not thinking so much about it yourself. But in return, you're paying more per unit for that. And like this is a concept that I think as technologists we are likely to have internalized over our career And uh there is a kind of equivalent in the energy sector. And this is uh it's it's useful to be aware of this because it helps us make sense of this shift that's happening and how it might affect us. So this is how things work in the energy sector. Generally, you've got different kinds of ways of generating power. And uh this is how it used to be. We used to have nukes at the bottom, really expensive.
Speaker 1: They're like the bare metal servers of the kind of power world, right? They're really expensive to buy. And then uh if you can use them all the time, you can kind of m more more or less make them work. But they're really hard to scale up and down. All right. Next one, uh Cole. It's uh It's a little bit like the kind of EC2 of power, I suppose, all right? In the sense that you can scale it up and down, but it's a little bit more expensive per unit. And then finally, you've had things like natural gas or well I see a lot of people referring to it as fossil gas because that's where it's from. Uh where it is a kind of a little bit like the serbilus of uh energy in the sense that you you use it to have uh you you'll use it uh it's you can charge a high amount for it and uh it's uh and you do you
Speaker 1: tend to have it on uh not all the time So you don't actually you you'll find cases where there are kind of gas-fied power stations that only are turned on when uh there is loads of demand on the grid. And they can charge such a high rate for that price that they can still make it work commercially for them And this is a and I think it's useful to be aware about this. And this is how it's kind of run for the last say 10 to 20 years. Now we've seen some interesting things happen in the last say 10 years. like solar has come into the market and renewables. Now renewables renewables are interesting because they unlike all these other ones here There is no fuel there's no coal on this there's no fuel to kind of pay for when you run this. So they can be cheaper than any of these here So if you run a nuclear plant and you've just made
Speaker 1: you've just built this with the assumption that you're better kind of own the lower part of the market, uh selling at a really low rate for ages, you're not really happy about nuclear c about about about solar coming in because it totally messes around with the actual pricing and your economic model. And uh I think it's also means where am I here? Yeah, but this happens but only when things are windy or sunny. So you've now got volatility into like the the the market, I suppose, uh where you didn't have this. Now I think it 's There also means that because you've got more generation in there, it kind of pushes the cost for many things slightly lower. And it means that prices can be lower. uh for power than they're used to it than they were before in times of abundance when there's loads of sun or loads of wind, for example.
Speaker 1: And uh because if you run say the national grid you you need to kind of balance out the grid all the time. Alright? And uh if you need to do this, if you've got more power coming in than people are using then you need to end up having you need to uh the the people who run these grids basically end up speaking to uh people who run power stations say hi can you kind of turn it down a bit please Now the problem is it's really difficult to scale some of these things down and it's very expensive to say scale down like a nuclear power plant, for example. It happens over a series of well days in many cases and it can damage the things. So in many ways, it's often cheaper to just pay people to use this airspare power. which means that n and power prices end up being negative, which is like a kind of weird for us because we're used to like paying for things.
Speaker 1: Now what we're up what what we're seeing recently now, in the last say five to ten years, we've seen the introduction of batteries. into like the power grid. Now this is kind of weird. It's like you kind of you've got this pincer movement from the future with renewables coming in, right? So you've got like renewables making things way way cheaper here. And uh when the power is very, very low, you've got this uh this another form of of basically dealing with a real h high demand for power in the form of batteries, right? And uh essentially you've got cases where you might have batteries which are paid to basically take power off the grid, then sell it back when it's really, really expensive, which pushes off or loading these things off the grid. So this is the kind of these are some of the dynamics that are affecting how we might actually uh When you think about say computing and like say data center
Speaker 1: data centers, because so much of the costs of running infrastructure is from power, this stuff is going to affect what we do as as people higher up the stack. And uh I think this is uh this is probably some of the stuff it's useful to be aware of. And uh now that you're aware of this, I think it's when you think about stuff like this. I think it I'm hoping it might kind of make you think a little bit differently about how we run what run services. So a lot of us we might build a thing for which is maybe a software as a service. solution for people who are work. And like when we are aware of this, we we realize that we might be thinking about this in terms of something running all 24-7 when really it's not being used all that time. And there might be other ways of basically designing things for that. It might be that if you were building something like say
Speaker 1: if you were designed for this kind of responsiveness. You might be able to reduce the amount of energy needed and reduce the amount of fossil fuels being burned as a result and also probably save some cash. And this is some of the ideas that this is why you see a lot of buzz around things like serverless and stuff for this, because I think that you see there are parallels between these two things. And this basically becomes more attractive and it's kind of greener in that sense. So this is some of the stuff that's happening, which is useful to be aware of as a technologist in the in terms of climate. Now I want to share like a mental model with you. But the reason I'm trying to share a mental model in the first place is because I think it's a useful idea that we've seen work in other places. So um has anyone heard or come across the phrase poor
Speaker 1: here? Okay, so this is the phrase that developers use who work in accessibility circles. All right. Now This phrase poor stands for perceivable, operable, usable and robust. If you are a front-end developer, you will learn this uh as a way to remember to design in a way which is much more inclusive and accessible. So perceivable is this idea that If you're going to build something, you need to make it possible that people can perceive the content. And if they cannot see things, you need to make it perceptible to the other senses. So this is like one of this is what perceivable refers to here Operable might be this idea that okay if you are designing for just designing say a site or an application, you can't just assume that people are using a mouse and keyboard And in many cases, when you want
Speaker 1: to touch devices, yeah, you don't have either of these things. So there's all these affordances you need to take into account. And when people do not have strong motor skills, you would also need to account for that kind of stuff as well. So that's operable. Now usable is kind of obvious, but in many ways, if you can't understand what a interface is telling you to do, then you're not gonna be able to use it. And if you are say neurodiverse, for example, maybe having lots of things move on screen means that you also can't use it. So that's the idea of usability, usable in this. Then robust is, okay, you know that thing where if you use a website like a single page web app on a phone and you've got a crappy connection, you're just waiting for a megabyte of JavaScript to download before you can do anything This is like not a robust application, especially if you're just trying to access a little bit of text, right? A robust version of this would be we send the text first, then we progressively enhance to something which does have this rich into
Speaker 1: this rich experience. So Things like poor help developers internalize this and people will refer to this. And these are actually principles in the guidelines that people use to see if a website passes or fails. uh a test and uh basically websites get sued over this stuff and we refer to these particular kind of principles And uh this is the this is the this is the actual kind of quote I probably should have left with led with actually. If you can make it easy to remember, then it's going to be more likely that people will remember to actually design in this kind of way. And this is kind of the thing I want to share with some of you, I suppose, or I want to kind of get some feedback from or test with you. Uh what if we had poor but for designing stuff, given the fact that we're in a climate emergency
Speaker 1: and pretty much everything we do runs on fossil fuels and we if possible we'd like to not uh how to couple what we do to all the kind of unintended i impacts of basically running an entire grid on fossil fuels. So this is the one I've been working on. It's called Green, Open, Lean, and Distributed. And I figured like most people like gold, or at least the idea of gold is somewhat aspirational. You know, would you like gold? Yes, please. Yeah. That's the kind of idea I'm going for. And I'll break this down in a bit more detail now. So green as in green energy or kind of low carbon power. All right. Now I spoke before about on the grid, there is uh there's this idea that you should be running on green power. And uh the the reality in many cases, if you were not running a gigantic hydropower
Speaker 1: uh hydro hydrogenerator in your own kind of office, which there's actually one place that does that does do that. You don't don't have that much control over the grid. So when people say we're running on green power, there's lots of different ways that you say that you might actually be doing that And uh I might say, say Denmark for example. Denmark is pretty good. When I was on the train here, I saw all these cool looking wind turbines and that made me feel very, very happy. Alright, but there are parts where you you don't have con I don't have control over. And uh if you wanted to say you're running on green power, the thing you need to do is you need to account for this. All right And uh the one approach which is I think is probably the best approach I've seen so far, if you is the approach that Google and Microsoft are doing, where they basically match the power they draw from the grid. the kind of fossil power
Speaker 1: and they feed into the grid the same amount so they could say that they get to say that all the power there is green. And uh it sounds kind of a bit weird and possibly somewhat unsatisfying in this sense rather than just literally running a sol hooking up a solar power to a server But this is kind of how a lot of it this is going to work because it turns out that having kind of uninterrupted power and having utility uh uh access to utilities is kind of useful, especially when you don't have power running all the time So this is the one that I think is actually quite attractive. And this uh again, when I refer to like in Denmark, Denmark is actually one of the kind of hotspots for this stuff. uh that same startup tomorrow. They're actually the were the people behind doing some work with Google and they provide these kind of stats for you to work these figures out yourself.
Speaker 1: The other approach that lots of all companies do is that they just offset the carbon emissions. And this is what some people do because To understand markets, it takes quite a while to get your head around, all right? Uh and uh you can do this. And uh when I work at the Greenburg Foundation, we've accepted people doing this because it's better than nothing. But sometimes the question you might ask yourself is, is this solving the problem that everything we do with the internet is actually having this kind of unintended harmful effect? Like uh I'm not sure it is, but it's better than stu it's better than nothing. And all you're doing is basically accounting for the carbon emissions from these two things and offsetting it that way, right Now, if you wanted to really kind of dive into stuff like power, if you want to say, oh well, you're doing it wrong, this stuff is really, really, really complicated.
Speaker 1: I've spent like two years trying to get my head around it and it's still uh I still am struggling to kind of understand all of this stuff. And I think it's worth bearing this in mind when uh when when when you see people talking about oh we're running on green power people being being quite dismissive it's actually quite hard to get your head around this but it's something we should probably be aspiring to. So that's green. Now open. Open is kind of stuff that we I mean if we're nerds we generally like the idea of open in terms of open source, open data, transparency, stuff like that. And uh I spoke before about say understanding how much fossil power is on the grid if you wanted to kind of zero out or be running on green power, right? Now I feel like I'm so sorry. This sounds like an advert for this company called uh uh t f uh from tom called tomorrow. They basically
Speaker 1: it's not, but I think they're lovely guys, but they are mostly guys, that's the only downside. It'd be really cool if there were more women in the company All right. But uh they basically make this available. This is a map called Electricity Map, and they track in real time what the carbon footprint is of power anywhere in the world they have access to. They basically take open data and put a nice interface onto it that you might want to consume or use yourself. And this is how they are working with companies like Google to come up with a more transparent way of accounting for the carbon emissions. But the key thing I want you to kind of take away from is the idea that depending on where you are in the world, you'll ha uh your servers will have a different carbon footprint, even the same code. So if I took the same code in Denmark It's kind of not bad. If I did it in Poland, because there's so much coal on the grid, it's gonna be much, much worse.
Speaker 1: And then if I went to Estonia, which is really, really bad, it's it's actually Estonia's not a lot better now. But generally you'll find this like a an artifact of the carbon footprint of your application is where you choose to run it. Now France, France is full of nukes, so it's really, really low carbon, but if you're not a big fan of nukes, you that might also be uh something on your agenda So this is one thing though this is one leaf you might have available to you and uh open in terms of like it's quite unuseful to have that. The other thing is that when we have open platforms, which I kind of consider Django to be, it means that we can get loads of optimizations from elsewhere in the stack. Alright? So even if if we were to think about okay, let's build our let's design let's let's go for the kind of cleanest, fastest, most efficient possible code.
Speaker 1: Because we're running on say something like Postgres. We do not need to actually resort to you introducing loads of other bits of kit that we might have had to use elsewhere simply because the stack we're using has a kind of really clear interface point to add new capabilities. And uh two examples I think are quite cool. Uh if you're working with say any kind of time series style data, you can basically like get rich reductions in the actual, say, resource needed just by having a different extension which takes advantage of some of the ideas that we might see in say Cassandra DB or other databases, which is actually, I think, kind of cool. And basic means that we get to still work in Django and we get the benefits of all the kind of No SQL kind of stuff. Likewise, uh if you work with data warehousing, because Postgres
Speaker 1: is an open source database designed to be accessible to lots and lots of people. There are some things in that there are some decisions which where they favored accessibility over efficiency. But again, we can use an extension to take advantage of things like that. So things like say Pandas and NumPy, they are designed in such a way that they can use some of the advances in CPU processes like SIMD or And so and uh and other other advanced and other advan advances to make things work way, way, way faster. So you can basically get a lot more performance from the same kind of kit. And uh again, there are extensions that let you do that kind of stuff. So there are actually things available to us when you have an open stack in clear ways that you can actually get integration points from. And If you tend to use MySQL, you'll see the same thing.
Speaker 1: Like MariaDB has similar tools now because they decouple the storage from just having something like SQL at a higher level. So this is some ideas of like open standards and so on. Now, is this working? Trying to get to the next slide. Yeah, okay. Yeah, um, oh whoops, that's two two seconds, folks. Sorry The L is for lean. If you're going to emit carbon, at least make it count. Now I found that it feels a bit poignant pointed to a flame graph when we're talking about uh like literally uh forest fires and stuff like that. But I actually find that flame graphs have been one thing that I found really useful. There's a book from I think Adam Johnson, he created a book called basically how to run
Speaker 1: speed up your Django tests. And he talks about how to use things like say flame graphs here. Now the thing that's kind of cool is when you run a command, there are this is a tool called PySpy, which you can use for any kind of test suite or anything like that. And it gives you an idea of like where what the call stack is when you run a command and then what's happening here and then basically what where which tests are making things slow. And this gives you an idea of uh where you might how it gives you a kind of visual way to kind of think about where to optimize first I just had to ch uh folks, I think I'm running out of power, so I might need to have some power plugged in in a second. I've got this one here Yeah, yeah, and if you can plug that in there, then that will help me save the day. Thank you very much. That's why things start to run slow just now. Good lord. Okay.
Speaker 1: So that's one thing. The other thing, if you care about say uh because we're working in the Python ecosystem, there's loads of other cool things we can do. Now there's a there's a group so there's a load of work in the kind of green AI movement. where people are trying to figure out how to understand the actual carbon emissions from code itself. And uh you literally can just install install energy usage. put a wrapper around what you do and then you can get some figures out of this now. And like uh they've they've literally put uh a kind of API on all the kind of complicated stuff internally for this. So if you look at this, you'll see that they'll figure out like where something is running in the in the world by hitting like a G OIP thing. They'll take into account all these things about carbon intensity like I showed you. And you can get some figures for this. And it was initially for things like say AI, largely because you have loads and loads of machines crunching numbers for a long time.
Speaker 1: But it's stuff that we could use because everything is open as well. And I think it's kind of cool because it's something you can like literally play with today if you are so if you're interested in it Now, so that's like server-side, but uh we're if we're working with Django, we're working about talking about the web and we send stuff over the wire, and it turns out that Sending stuff over the wire uses servers which uses fossil fuels because of user power. So uh there's chances you can optimize there as well. Now there's a tool called um Lighthouse. Has anyone here used Lighthouse or come across it before? Okay, it's about half the room. So Lighthouse uh is essentially a way to it kind of grades you on how f how green or so how fast uh and how good your website might be. So you point out a web page, it will tell you what the performance is like, how accessible it is, how good it is for SEO, and so on.
Speaker 1: Now last year I started looking at this and I tried to figure out, okay, can you extend this? Because this is open source. And uh yeah, it turns out that it was actually an extent an interface where you could extend this So we started building something so that if you run Lighthouse, you can now get an idea of the carbon emissions from this. Now the thing is, I'm a big fan of like lots of things that Google does, but I'm not sure that uh the priorities of a trillion dollar advertising company are always the same as the priorities that I might have. All right. So there are other alternatives as well And one example is SightSpeed, which is another kind of web web performance analytics kind of tool for this. Now the thing that's cool about them Is uh they have different priorities on here. So an advertising company might not be so bothered about say privacy and uh you might
Speaker 1: uh they they there might not be taking into account things like say surveillance like that thing where you run up when you visit a page then you have to wait for a bit while all the ads while all the auctions run before you actually see any content. All right Now side speed's kind of cool and again because it's open you can extend it. So I uh we did some work with them uh when I worked with the GreenMep Foundation and we built like a sustainable web plugin that lets you track figure this stuff out So we basically use some of the kind of science and nerdy stuff that I've been doing. And uh we there's an illustrator who did kind of cool Greta cat, which I think is just uh made me really, really happy when I saw it. I didn't know it was there. But these are like some tools you can use for this stuff. to figure out to actually see how you might have an impact at the kind of network level as well. And if you think this is kind of cool, there's this whole set of new companies who are doing things in this.
Speaker 1: So there's a company called Cabin uh now and uh they basically do privacy kind of privacy aware carbon calculing calculating analytics using these ideas here. And uh Yeah, they give you an idea of where you what you might have and this is actually a real thing and it was kind of embarrassing. I realized that one of the pages, I totally optimized it wrong. So if I clicked on this, I could jump into it, it could tell me where the big kind of kind of culprits and things they need to fix are. So there are tools which you can use and incorporate into your tool chain to actually understand this stuff in production as well now. So that's lean. Now the final one is distributed. And uh I hope that we've been speaking, I'm talking about distributed in terms of space, which I've mentioned before, but also time. And I think time is the kind of interesting one more so than the other one, and that's when you're probably going to have some access to.
Speaker 1: Because if you say, Boss, can we please run our servers in Switzerland on Wednesday, then they might not be super keen to do that because migrations tend to be kind of big scary things Now, there is some really interesting work going on with Microsoft right now. There's a guy called Asim Hussein who's been building a website called uh principles. green, and uh he talks about this idea of shifting demand or or the your use of compute to kind of match what's on the grid. And uh to an extent, when we use anything like say a cron job or a queue like Celery, we're kind of already moving work through time We're just using it for say performance reasons rather than green reasons. And uh because we spoke a bit more about uh because we covered before about say how the How but
Speaker 1: because before we were talking about things like say uh the cost of energy will change depending on what's on the grid and and things like that. There's actually a chance for us to go from other being just consumers, we can be active participants in the grid to help balance it and in some ways be paid for this And like uh here's the kind of like concept I want to share with you. There's this thing called the duck curve, partly because it's kind of duck shaped, right? And this is like an actual academic thing that people uh they're like there's a whole f l load of people talking about this in the energy industry around this. And generally, when you have lots and lots of power on the grid, you'll see this case where you basically have more power than can be used. Right? And uh like we said before, because we know that like nukes are really hard to scale down and fossil fuels are uh like coal is hard to scale down, it's often cheaper to just pay people to use power
Speaker 1: then basically call pick up the phone for the guy at the nuke station say, hey, can you like poison your own nuclear reactor for a couple of weeks? Because they're just going to say not like they will not want to do that. And uh you end up with a case the I think like this kind of stuff will end up being exposed to us as developers more over the coming years simply because it's going to be a way to essentially pass this on to to end users so they can do something with this. And in Django Land, we're already seeing this at the consumer level. So Octopus Energy are a kind of well-known Django shop in uh in the UK. They have a really really good style guide if you're a Django developer, which I use all the time. But they've been doing this kind of stuff. They call they call it plunge pricing. And as an end user, a consumer, you'll be paid to use power at certain times
Speaker 1: So they can pay you to basically wash your clothes at two AM rather than uh say uh when when there's a peak at six o'clock when everyone gets home And this essentially is what you're seeing examples of kind of Google do stuff do stuff like this now. All right. Google have got a lot of press recently by shifting their work uh their workloads. to when energy is uh cheap and green. And uh I think that it's not just Google who's gonna do this kind of stuff. Uh because Oh ten minutes left. Okay. Oh great. I'm ahead of time. Great. So I think this is actually something that we're going to see more of, simply because there is actually just in many places there is actually quite an increase in uh data centers being going onto the grid Now to give you some perspective, Denmark, uh their own energy projections, their energy
Speaker 1: agency in Denmark have basically they put say fifteen percent of all power in Denmark to be used by data centers uh uh by 2030. All right. So one in six watts is going to be doing this kind of stuff. All right. And uh it seems uh it's it's it's useful bearing in mind that data centers are one of the most energy intensive per square foot kind of buildings that you could possibly have. Even more than say aluminium smelters, which are traditionally the things that are cr really, really energy intensive. And uh I feel like there's this chance which this kind of stuff totally changes the economics of how we might work as developers when the thing that you're using might actually be, rather than at a cost, it might actually be a kind of source of money coming in. So like if you design it, I think there's a chance to design accordingly for this. And I think that this is the kind of stuff that if you are not aware of
Speaker 1: And if you don't understand the context in which is going on, you'll understand why are people so excited about this stuff. Because I think it changes how we might work and how we basically uh the the economics of what we do. So that's like gold, green, open, lean, distributed. It's like a work in progress. So I'm not sure and I really welcome kind of questions and feedback or whether you could see how you might apply it in your own kind of context, I suppose. The final thing I'm going to share with you is this idea which I found quite helpful. Stacktivism. If you're a developer and you care about this stuff, you'll notice that I've been referring to Google and Microsoft again and again and again and again and again. And like I think it's because this is the problem. This is a this is this is this is the choice we have to make as technologists right now. If you care about
Speaker 1: Basically, you get to choose two of these, but never three. All right. Fossil fuels, kind of important to be doing if you're a responsible professional. But also if you're a responsible professional technologist. you'll often in many cases choose to use a hosted service rather than have all your development time doing a thing which is not core to what you're for or what you're working on. The funnel thing is also in terms of like having kind of healthy ecosystems Consolidating all the all all of our all of our spending around three companies who are also helping drill for oil, probably not that good an idea in the long run. All right, but we're the w right now we can only pick two as professionals And that kind of sucks in my opinion. And I think that we need to think about this, about the stacks that we build and what we choose to build, what we choose to work on. Because I think there are there's stuff that we can actually do with technologists to address this.
Speaker 1: So these are the primitives we might use when we are developers or building any conditional service. Compute storage network, this stuff we know about, right? Now these might manifest themselves as I don't know, paying for virtual servers, some kind of object storage like Amazon S3 or something compatible, or some kind of software-defined networking like a load balancer or a private network or something like that. And like already just trying to find green versions of this stuff this stuff is it's not that easy. You do find some options now, but has it it's still quite hard to actually just find green, like zero carbon object storage in say Denmark, for example, you're gonna struggle a bit. Now if you think about the things that a lot of us use now, right? We might be say using paying someone else to manage a database
Speaker 1: because after a few years we realize running databases and managing them is actually quite hard. And if you've had enough scare stories that we don't want that to be our problem to solve. Or it might be something like say managing Redis when it goes above a certain size is a pain as well. Or like managing search, all these things. You can pay to get hosted versions of this stuff right now. But the pl the number of companies you can get this from is actually quite low. Likewise with things like say, I don't know, Kubernetes, for example, there's two or three very, very large players. When um but if you do not want to if you want to go for all three from that three the the choices I made before, not so many options. Likewise with serverless We don't have some so much there. Now, if you want to kind of build, say, Django applications that scale down to zero or only are served when your request is coming in. There are ways you can do that.
Speaker 1: Cloud Run is an example for that. And like Lambda from AWS offers you some stuff like that. And there are frameworks like Zappa that make that possible. But the underlying code is open source. But no, but we don't we're not seeing people use these kind of things. And I feel there's a market for this. Likewise, like all these projects are open source projects that are things that if you wanted to build a stack, you need to make compromises on right now as a as a professional And I feel that kind of sucks and it's something we should probably address and think about. And if you're going to kind of start a business or work in some kind of service, maybe it's the thing you'd take into account. So this is kind of how I kind of frame it or just want to talk about the other people. Like uh I think we need something like fossil free stacks, right? We need a way to Be explicit about what we care about and embed some of the values you might have into what we do.
Speaker 1: And I think that fossil fuel stacks kind of needs to go and like that's because yeah, we really are out of time. We need to be doing something faster than we are right now And uh this is kind of the stuff I share with you. I think if you want to fit if you're thinking and worried about kind of climate and you're working as a technologist, there's a few spaces that you could actually kind of incorporate this. And I think one of these is Okay, we there's a narrative about building a fossil-free future and getting away from what we have right now. And I think finding work in that is becoming easier. And like there's literally two or three companies I've mentioned just now who are hiring for this kind of stuff. And there's also opportunities that someone is going to make a lot of money out of and it would be nice it would if it wasn't just Google and Microsoft, right? And uh I think that if you want to make the web green, then uh
Speaker 1: you can make Django gold And I think that's kind of largely it. I think I'm a little bit ahead of time. So uh I'll happily uh I'll answer most questions and do it, but if there is a bit of time, I don't mind answering one or two now. So yeah, that's me. Cheers, everyone.
Speaker 2: Thanks so much, Chris. We mentioned questions from Sweet. Yes. And uh we forgot to mention questions from the audience. So if you do have a question, you're welcome to ask it on Sullib um because we don't have a portable mic ready. And and and we cannot uh stream your voices to the internet. So we can you can also ask a question and I will repeat it from up here That's the way to go. Yeah. Thanks so much, Chris. Sorry, we should also keep it distance up here. So
Speaker 1: What do we do now? Christ, we haven't thought about this, have we?
Speaker 2: Joel is our question host and uh Joel is uh ready on uh on SULIP. So if you have any questions please uh ask them and uh Joel will forward them and I will see them off the my screen and then I will ask them. And we have uh about five minutes uh until we have a scheduled break.
Speaker 1: Okay.
Speaker 2: Um and our breaks are so that uh we can have a break here at the venue, but certainly also so you streaming at home can have breaks. And we 'll show on the screen how long the break is and uh when we're gonna miss it. Um I'm still giving Joel a little bit of time in case there are questions, but I do have a a question. I've uh by clicking a little bit around on uh Wikipedia I've seen something called the effect. Yeah, it seems that uh if something becomes more efficient then we should in theory need less of it because it's now more efficient. Uh for instance with coal.
Speaker 2: It was so that the the coal combustion mechanisms became much more efficient than then you'd think we would just use less of it But somehow we started using a lot more of it.
Speaker 1: This is actually correct, yeah. Uh so is is the question the qu the question if I understand it is how does this play into the world? And like does making things efficient actually make things greener? All right. And uh There's actually it's difficult to see where there it's first of all, this is actually a concept which has been around for like 200 years. Like this was a this was first uh observed by William Stanley Jemins uh back in uh like Victorian times when he realized that by making uh steam powered uh kind of ste steam engines powered by coal, when you increase the efficiency there, people just use more steam engines. because they're suddenly cheaper, right? And uh I think this actually speaks to a kind of w large larger discussion about decoupling. So right now there's a whole focus around uh absolute decoupling, which is this idea that we can just totally decouple
Speaker 1: uh economic growth from I guess the physical impact of what we do. And I think that that's a little bit sci-fi. All right. And I don't and I don't think it's actually that con convincing. And there or there's relative decoupling, which is Yes, you can make a you you can decouple these to a degree, but you still need to do make other decisions. And I think that the the best answer would be that for something like Jebit It's something we should be pursuing anyway, but it's not a get-out-of-jail free card. And in many cases, it's presented like a get out of jail free card so that we don't need to make any changes to how we live or how we work. And I think there is actually a a couple of good papers that I could point you to that do basically address this. And they say the same thing that yeah, it does and it does have a it can create a net increase in the amount of energy, which is basically why I see
Speaker 1: say the thing we need to do is not have be have fossil fuels in it at all. Like to forget about don't talk about efficiency, talk about carbon. And then it's a I think it's a more satisfying and useful conversation to have.
Speaker 2: And if you ever say live today, you probably say um it's all it was up.
Speaker 1: There is um if you want to sound really, really cool and really really like flashy There's um some people that you can also refer to this as the Kazum Brooks postulate because two guys in the 70s uh and the 80s basically came up with the same thing and uh they got a load of press in economic circles And uh there's like numbers for it and there's like a coefficient and there's ways you can have like a kind of numerical discussion around this. However, that's not my job. I'm out uh that that's that's beyond what I can keep up with. But it does sound cool there, right? Cause who 's postulate, who's gonna challenge you there?
Speaker 2: We do have some uh questions from the internet And the first question is from Joel. Is this where I should paste the questions? Yes, Joel. And the second question is from Rasmus. Who's asking on YouTube which cloud service provider is the Breenus today?
Speaker 1: Uh the okay. So you know what I just showed you that kind of stack thing of all these different options. Depending on what you call what you want from a cloud, it's gonna match, it's gonna be different. The one that I I think is probably the greenest in terms of the most obviously zero carbon is one called uh the data center light. Like uh I work at the Green Road Foundation and we check. Uh we run a directory of which websites are green and which services are green. And when we got in touch with them, we expect that they'd share like some numbers or shut some certificates. They just like sent a photo of a giant bright red hydropower generator, which they use because they literally have a data center in a disused uh factory which used to be right next to a water wheel. Uh that's the greenest one is the is the one I would probably use if you really, really cared.
Speaker 1: However, has to be in Switzerland and they don't provide all the services that you might have, but they do provide a lot of services That's the one I think is probably the most if that's one that's worth worth looking at, if that's your key driver. But that isn't always the key driver everyone does have.
Speaker 2: There's a similar question from from Joe. And perhaps it's it's more about the leadership. Who who which companies are really taking a lead in? The transformation.
Speaker 1: So I I think it's really complicated because all the people who are doing really good stuff are also doing really, really bad stuff, right? And uh I guess well that's life, I suppose. But I am really, really inspired by some of the things that Microsoft is doing right now. They are literally running a conference called GreenConf at the end of this, I think it's yeah, like uh at the end of this month where they have a load of people ins inside the company really pushing for this. They have a head of green cloud advocacy who's coming up with principles like this. Uh who's uh and There is a load of really interesting work from there and uh the lot of the things they're doing systemically make a lot of sense. But they are also the biggest pr uh they they they they are the the the they they they are the the market leader in the oil and gas sector. So you've got this problem and you can make the argument that utterly undermines all the other work they're doing.
Speaker 1: Uh likewise at Google, the work they're doing with carbon-free uh where they've basically tried to balance out power like you saw but at a kind of hour by hour basis which is really hard I think they're also absolutely leading in that sense And uh at the same time they also have contracts with oil and gas. They are doing less and in total I think twenty nineteen they made like sixty five million dollars from oil and gas, which is like, let's be honest, that's maybe what I don't know, 30 Google employees. So for the sake of 30 Google employees, they are running their own name through the dirt, right? But they are now actually Uh they I mean I'm joking a bit about that, but I those are the two companies who are from a policy point of view doing some really interesting work. But the nice thing is they're showing what they do. So there is space for smaller companies to do the what they do as well
Speaker 1: And I think that you could quite easily apply you could totally take the ideas that they have published, apply them, work with someone like electricity map or anyone providing this kind of carbon intensity and replicate the same thing. And if you are a company looking to do that With my Greenbaby Foundation hat on, I would really love to speak to you because that's exactly what I would like to do as well.
Speaker 2: We have uh two more questions and then I think uh We have to finish that. Hans asks, would it make sense to implement PySpy or energy usage into production?
Speaker 1: Uh I actually feel that there are better ways of tracking this stuff in production. And again, I'm going outside of my area of expertise now. All right. There are lots and lots of tools that you can use for like distributed tracing and stuff to kind of get an idea of this. And uh tools like Scout, I think, or or various things like that, which you use to kind of track production uh performance of production anyway. I mean the math for a lot of this stuff isn't really that complicated. If you know how much power you're using, what grid you're on, you can roughly work out the kind of carbon emissions there. if you're if you're running the stuff yourself. However, if you are using some kind of tool from like some serverless tool from Google and Microsoft, They tend to be more cagey about these numbers because a lot of companies see these as kind of commercially sensitive, so they won't share this stuff.
Speaker 1: If you go to Amazon, you need to be spending at least 15k with them before they will just give you a single number with no no real breakdown Which is partly why uh we started working on a tool called Green Cost Explorer, which uses Amazon's Cost Explorer to give you these numbers. But uh like this is uh yeah, I think that give does that help answer some of the question, I suppose?
Speaker 2: I think so. Um The next the next question is uh perhaps also uh an invitation to uh to join uh the Sulub chat. Um Lars Peter asks if you can suggest a list of links for further reading about the subject. Yeah.
Speaker 1: The deck that I worked from, every single uh basically I was reading a lot of this stuff. So there's like a couple of thousand words in there There's also a Slack channel which I help organize called climateaction. tech where there's loads of stuff written in there. I'm happy to kind of flesh this stuff out And the reason I was really plugging the Zoom at thing was because when I spoke to Ben beforehand, we said, hey, what we should do is after this call, we should do a Q<unk>A, an editor Q<unk>A of this stuff. So we have all these links for anyone who was interested by this. And they got so they got somewhere clear to follow up And I think is that have I used all my time now or is that everything?
Speaker 2: Yeah. Um let's give Chris a big hand again.
Adams estimates that tech, data centers, and the internet account for about 1–2% of global emissions—roughly comparable to shipping or aviation—and notes that the sector’s emissions have grown more slowly than some others, partly because of efficiency improvements.
Discussed at 7:52Scope 1 covers emissions from fuels an organization burns directly; scope 2 comes from the electricity it uses; and scope 3 covers its wider supply chain and other indirect emissions.
Discussed at 10:56Because power can be abundant at some times and costly at others, Adams suggests designing services to be more responsive rather than assuming they must run at full capacity around the clock. That flexibility can reduce energy use, fossil-fuel emissions, and costs.
Discussed at 20:58It stands for Green, Open, Lean, and Distributed: use low-carbon energy, favor open tools and data, make resource use count, and distribute work with energy conditions in mind.
Discussed at 24:56Adams describes matching the electricity drawn from the grid with an equivalent amount of power supplied to it, as Google and Microsoft do. Carbon offsets are another option he mentions, though he treats them as better than nothing rather than a full solution.
Discussed at 25:43He points to Py-Spy and flame graphs for finding performance bottlenecks, and to the Python energy-usage package for estimating a program’s energy use and emissions.
Discussed at 32:40Note: 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 October 13, 2024
Published October 13, 2024
Published October 13, 2024
Published October 13, 2024
Published October 13, 2024
Published October 13, 2024