As developers, how can we make our developments more sustainable?
In this blog post, I share some of my personal thoughts on how as developers we can make our developments, our development process, more sustainable.
Let’s start by clarifying what I mean by sustainable…. I’m not thinking of coding best practices or how can I can make my code more manageable or how can I deal with a legacy code base or monolith vs microservices. No. In this blog post I’m interested in exploring how can my developments have a lower impact on the environment.
⚡️ Please share your ideas and best practices on how you make your developments more sustainable in this SAP Community Group discussion – As a developers, how can we make our developments more sustainable?
We often hear/read about how companies are more aware of their environmental impact. Some of them are changing the way they operate and are a now more conscious on how they manufacture their products. As consumers, we are also more aware of it and fortunately some do have a choice on whether buying or not a product that’s more sustainable. This is good but I often think that apart from what we purchase, there is something else that we can do, especially now that we do so much online, to reduce our environment impact.
As developers we spend a lot of time online. Not just sitting in front a computer/laptop but also through our tablets, mobiles, watches, IoT devices, the servers/services we run, we create a lot of data, we download/stream a lot of it, our backups, etc. We do interact a lot online and all these interactions require energy to be up and running.
If you want to learn more about the energy consumption of different devices that we use, e.g. desktops, laptops, mobile devices, game consoles, streaming, check out the various links included in Footnote 340 / Computing And Carbon of the Carbon Almanac – https://thecarbonalmanac.org/340/
So, how can we make our developments more sustainable?
I believe we can boil it down to the following…. If we can reduce the time something is on, online, running, we reduce our energy consumption. Fortunately, some of our workloads have moved to “the cloud” and there is a strong commitment from popular cloud providers, who plan on running their data centers on renewable energy or carbon-free energy in the next couple of years.
I know that some of the ideas shared below might not be that convenient, but well, it might be time for us to consider that not everything has to be 100% convenient. Here we go…
- Access data faster:
- Optimise an algorithm: Look at a long running process and see how you can speed up its processing. A second or two faster ends up being something significant if that process runs frequently and you do the math on how much energy it will be saved in a day -> week -> month -> year.
- Cache: If a query/resource is accessed frequently, it is a good idea to cache it instead of having to go to the database everytime. Less time it takes to process the request, less energy consumed.
- Indices on tables: The faster the query runs, the faster we finish processing. Less energy consumed. It is important to keep track of common queries and analyse when a secondary index can speed up processing.
- Not everything needs to be online 24/7, we can assess how long something really needs to be running. For example:
- Personal workstation: No need to remain in sleep mode. Shut it down. It is refreshing to start your day with a laptop that doesn’t have a zillion apps/tabs open.
- Development systems/servers: Consider if it can be active only during working hours. The same might apply to services that we are exploring as part of a PoC. Remember to “clean up” once your PoC is complete. No need to keep the service running if it is not actively needed.
- Personal servers: Consider turning them off at a specific time and turning them on automatically at the beginning of the day, similar to development servers… Rarely that server needs to be running while you sleep.
- Backups: Not everything requires a backup. I know, this is controversial as we don’t want to lose our precious data but it is true.
- Redundant data: Consider hosting common resource in a single place instead of sending a copy to everyone or maintaining multiple copies of the same data.
- Validity of some data: Some data has a validity period, after which it can be safely deleted, e.g. that meeting recording that took place a year ago, which might no longer be relevant, it is ok to delete it. That said, you need to be careful about which data can expire and be safely deleted.
- Data that’s generated from other data: This is very common when training Machine Learning models… you do some data preparation, train your model, see if you get good results, if not go back to modifying data, using different parameters or add more data, train again and so on. If we take a snapshot of every single iteration then we will end up creating a lot of data which might not be useful in the future. In reality, the only important data might be just the data used to train the final version of the model -> the model that’s deployed/running in prod. We don’t need to keep snapshots around of all the failed experiments. You don’t need a backup of every snapshot created to train a Machine Learning model. Given that we will have some form of pipeline to prepare the data before training our model, if we end up losing the data, we can easily reproduce it by running again the pipeline that created it.
- Consider offline: Your backup doesn’t need to be available 24/7. Maybe it is possible to have a backup in an external drive that you can unplug.
Clearly, backup requirements will vary depending on the industry you work on or due to legal reasons, but this might only be relevant for what get’s deployed to production and not for that PoC that you are doing during development. Also, if you can generate the data and you lose the generated data, just run the pipeline again.
Not directly related to development but also important to keep in mind given our huge online presence:
- Email: Do you really need to send that email? The more data we produce the more data requires backups.
- Mobile phone: It is ok to turn it off. Less need to charge it, less energy consumed. There’s plenty of technical books 📚 to read out there that can keep you entertained ;-).
- Search engine: You can use and promote using a different search engine, e.g. Ecosia. Pretty good search engine if you ask me.
⚠️ Although a search engine is very convenient, we don’t need to search absolutely everything, e.g. there is no need to search the URL for online services that we access on a day to day basis. We can easily bookmark those URLs, avoid the need to search for them via a search engine, and access them directly.
- Reuse old equipment: Developers normally use high-end laptops/desktops which after a couple of years might not be suitable for our day-to-day but the equipment might be good enough for a someone else, e.g. a family member. That said, you can easily install a different OS in that machine and make it run as fast a new for someone who doesn’t require a beefy machine to browse the web/deal with spreadsheets :-).
Thank you for making it this far in the blog post. I hope you find some of the ideas shared above useful. Being 100% sustainable is nearly impossible so don’t worry about not being perfect. It is better if we do something about it than doing zero in search for perfection.