 Hello, good morning, and welcome to my talk about sustainability and efficiency, environmentally friendly software development with Kubigrain. To start off a little presentation of myself, I'm Davide Bianchi, a senior technical leader. I'm from Italy and I'm working in Mia Platform. And I'm responsible for the product development in Mia Platform. And with this job role, I saw how many resources can be wasted also in the IT industry. What is the agenda about this talk? We will talk about an intro to sustainability. The sustainability in the IT industry with some example and data about how many resources can be wasted, can be used by IT. A little discussion about green software and how we can make green software during the software development. We will talk about Kubernetes and more in detail how to reduce the consumption of energy and reduce the emission of carbon dioxide using Kubigrain. And some conclusion and take away. Ok, so it's important to say that sustainability is not only about environmental realm, it's also about economic, social and environmental realms. And all of these create the sustainability. And in the IT industry, an example of environment with sustainability is, for example, the open source in my point of view, because there is the needs of economic sustainability in open source. There is the inclusion of where there are communities and who are welcome to contribute so there is also the social part. And these communities help to create better software and to reuse the software. So there is also, from the environmental point of view, an improvement. As part of my involvement in the open source, I created Kubigrain. Kubigrain is a Kubernetes operator with the aim to reduce the carbon footprint of our Kubernetes cluster. And we will see more in detail later. And it's available on GitHub at the link github.com slash kubigrain slash kubigrain. Ok, environmental sustainability in IT, how we are using resourcing in IT. The consumption derives from the compute, so the use of CPU and GPU, the storage of data, the networking, and the manufacturing and so creation and the disposal of the hardware of the server. The transporting of server from factory to the data center and the cooling equipment, for example, for the server in the data center. So we should take in mind that all we do online run on a server somewhere. So also the code we write also released on a server consumes energy and produces carbon. Let me take some example of consumption in IT, some really big example. The global electricity demand of the IT industry is about 1.3% of the global final electricity demand with an emission of 330 million tons of carbon. These are big data and in these numbers are not counted the mining of Bitcoin, for example, and other cryptocurrencies. So the electricity demand of the mining of Bitcoin is about the 0.4% of the global final electricity demand with an emission of 68 million tons of carbon equivalent. This means that around 2% of the global electricity demand is used by IT industry. But let me see, let me talk about an example much more smaller. Smaller is something that we use every day in our working and private life, the email. What is the environmental impact of sending an email? A standard email produces a carbon footprint of 4 grams of carbon and this is without an attachment. If we add an attachment we will arrive to 19 grams of carbon and in average every person receives every day 100 email. This means that every person in one year produces 150 kilos of carbon which is more or less like driving a mid-sized car for 1,000 km. So really interesting how sending and receiving email can impact on our environment. But how can we reduce the consumption of energy? We could not use software and it's our work so it's quite difficult to not use software and software is more important in all working environment and also in our private life. So the real question is how can we create more sustainable software? There is a practice called the green software and it's important to say as the first thing that there are some groups of which already talk and contribute to spread the word about the green software. And here I take a couple of examples. For example the green software foundation which mission is to build a trusted ecosystem for people standards tooling and best practices for creating and building green software. And for example also the CNCF tag of environmental sustainability which goal is to advocate for develop support and help evaluate environmental sustainability initiative in cloud native technology. For example the CNCF tag on environmental sustainability in the past month in October and sustainability week with meet up all around the world and it was a really interesting week. And there are also some on YouTube some video of this meet up. Ok, but what is green software? Green software is a carbon efficient software meaning it emits the least carbon possible. And there are three principle of the green software. The energy efficiency, the hardware efficiency and the carbon awareness. Let me talk about energy efficiency. It's important to say that energy is derived from the use of fossil fuels so from coal, oil, natural gases and so on. So use energy produces carbon. So to create green software we should reduce the energy consumption of our software. And for example when we architect an application we should think about what is the correct number of microservices of our application. For example if we have an application with 100 of final user it's quite useless to create 100 different microservices because maybe in the future we should think about maybe create better code to scale in a second moment if it's needed. So write efficient code, so use performant programming languages, effective algorithm and also efficient framework. Optimize the time link, so optimize the transmission and the storage of the data. And use new and more performant hardware. For example the use of ARM architecture which is less energy consumption of energy. Ok, let's take the second principle which is the hardware efficiency. There is an important definition of the hardware efficiency which is the embodied or embedded carbon which is the amount or carbon pollution emitted during the creation of this disposal of a device. How can we reduce the embodied carbon? There are a couple of strategies. Extend the lifetime of the hardware. So this is called amortization. And for example if we need 4,000 kilos of carbon to create and dispose of a device, a server. If we use this server for a year and the amortized carbon is 1,000 kilos of carbon if we use this server for 5 years the amortized carbon is 800 carbon for every year. So extend the lifetime can reduce the impact of the hardware. The other strategy is to increase the device utilization. So for example it's better to use only one server at full capacity rather than 5 server at 20% of capacity. This is because of the cost of the embodied carbon. But why we sometimes use 5 server instead of 1? This is to respond to the peak capacity and it's one of the biggest advantages of the public cloud because in the public cloud if we need more resources we know that we can have it. And the last principle is the carbon awareness which is do more when the electricity is clean and less when it's dirty. So use more electricity when it's coming from lower carbon sources like renewables. How can we do something with a carbon awareness in the real life? There are also in this case two different strategies. The demand shifting and the demand shaping. The demand shifting is move our computation. For example we have to run our workload for a machine learning model. We could shift especially this workload to a region which has a lower carbon intensity so that we reduce our emission of carbon. But it's not always possible to move our computation to another region. So there is also the temporal shifting. So for example if our model needs some data which we cannot move around the globe. For example for regulation or other things. It's possible also to maybe to take the temporal shifting. So shift to another time during the day or night when the carbon intensity is lower. The other thing we can do with the carbon awareness is the demand shaping. So instead of moving the demand change the demand based on the carbon intensity. By theory it's quite easy. If the carbon intensity is low do more in application. If the carbon intensity is high do less in application. In the real life it's not so easy. But there are a couple of real life examples we already have. For example the eco mode of our appliances. Or also in software with the streaming software. The software quality is changed automatically based on the bandwidth. But we can also introduce this carbon awareness in our application. There are some examples. For example we can reduce the performance of our application when it is using some dirty energy. But what it means reduce the performance. We cannot reduce the performance of the final user. But maybe yes we could for example put a button inside our application to let the user choice and switch to an eco mode usage of the application. Or maybe our application is for the final user it's the same if our application API responds in 30 milliseconds or in 10 milliseconds. In this case we can reduce the performance when the energy is dirty and go to full power when the energy is clean. We have now seen some rules, some best practices about the green software, the sustainability in the IT industry. And let's now see inside the Kubernetes environment and in cloud native. And let's start with an application example, an e-commerce website, which has some traffic surges. So during product launches, sales event and so on traffic can surge significantly. So the resource demands can vary through the day requiring more resources during peak hours and fewer during traffic periods. And the solution is quite simple in Kubernetes it's possible to use the auto scaling solution with the HPA to address the traffic peaks and to reduce the number of workload during equator times. Auto scaling is based by some metrics such as usage of CPU, usage of memory and other custom metrics. And the important thing is that auto scaling is not only about upscale, but also about downscale. So when the resources are unused, not necessary, it's important also to downscale the application. And these as repercussion both on cost and on environment. Because the first driver to reduce our emission our energy consumption is to think about to reduce our cloud cost. Because cost in cloud and energy are strictly related. So in a first time it's a good driver the cost and when we optimize the cost we could think about only the sustainability point of view. Ok, we have our application and we should develop this application and create a new feature and so on. To do it we have one production environment and a lot of non-production environment we have testing, development, UET, Q&A and so on. This non-production environment are used during the working days so for more than 75% of the time in a week are unused. What it means? It means that also if they are unused the server in idle consumes some energy because also as some CPU and some memory is needed also in idle. And we can address it with kubegrin. Kubegrin is an open source solution which runs inside our cluster. It's easily configurable with this configuration. For example in this configuration we say that the weekdays are from Monday to Friday, one to five. At 19 turn off all the pods inside our space and at 7 in the morning turn on all the workload in our space. It's possible to exclude some references and so on, but the important thing is that at sleep time, at schedule time our workload are stopped and restored. How can we use kubegrin? It's really simple. It's needed to install. This is a QCTL apply of one file for only one file. Configure the sleep info inside the desired space and see kubegrin in action at the schedule time. So it's really simple. There is a tutorial available on the kubegrin website and working on kind, but it works also on all the Kubernetes installation. OK, so let's now see some real life usage. We have some chart. This is a cluster of 15 spaces and three of them have kubegrin installed. We can see that there is the five peaks that are there working day and five slope that are denied and larger slope, which is the weekend. And we can see there is action in both of memory usage and of memory request inside the cluster. The same, for the memory, is the same as the CPU. The reduction of the request of the CPU is a reduction of the allocation of resources inside our cluster. So this is another cluster we have in the platform with 75 spaces and 48 of them with kubegrin enabled. We can see that there is, every night, 600 pods are turned off with a reduction of usage of memory of 33 GB and reduction of use of CPU of 3.5 core and also the allocation, so the request of memory is reduced by 45 GB and of CPU of 25 core. So a really interesting reduction in the usage and allocation of resources inside the cluster. And with this cluster, with the cluster toscated enable means that every night the four nodes of this cluster are turned off with a reduction of both cost, energy consumed and some carbon not emitted. So it's quite interesting to see this chart because there is more or less a 30% of saving in cloud cost. And some final note of kubegrin, some data on the kubegrin controller. There is an interesting number of adopters which already use kubegrin. Some of them are listed on the kubegrin website, but there are a lot of other users which are not listed here. And there are more than 200,000 downloads of the Docker image and talking to our users and by our metrics we can see that there is a reduction of at least 30% in cloud cost with the consequent reduction of emission. So really interesting results. To conclude, some key takeaway. Sustainability is important also in the IT. As we already saw in the first day at the day keynote and also today at the keynote there is a talk about sustainability. And it's important to think about it in all the software lifecycle. There are some groups which can help you to create some green software. So there are Slack channel and so on. You can talk about these groups. There are also very interesting open source projects to help to measure and to reduce the energy consumption. For example, here there is Kepler which is a really interesting open source tool. The environment sustainable transition could start thinking about the cost savings of our application and in Kubernetes environment it's possible to improve the energy efficiency using kube green. I hope you enjoyed this talk. Thank you. And start the kube green repo if you want. And if there are some questions. Great, thanks. I'll ask if all the hyperscalers assuming they will someday switch to clean energy, solar energy this will mean that we don't need to save the resources. Yeah, it's a safer of resources but the resources, the solar and wine and other renewables are not used at the moment so largely. Very often when we use for example a data center or a cloud provider we are using both renewables and fossil fuels energy. So reduce the energy consumption means that those 2% of energy used by IT industry can be decreased so there are more renewables energy used by other industry for example which needs more energy and it's quite more difficult to reduce the consumption. Thanks. Thank you. Okay, thank you.