Skip to main content

Mad Mirrajabi

All you can’t eat

Table of Contents
  • Me: “This large RDS Aurora instance on this dev environment seems unused for the past 6months!”
  • Colleague: “Yeah, we don’t need it anymore. You can delete it.”
  • Me: “Boom! That was $12k/year and lots of energy saved.”

The above is a true story, and I’ve seen it happen so many times. It’s not only the money you’re saving, but if applied by everyone, it helps us save on so much energy and material.


Modern software development, especially on cloud is so wasteful in terms of compute and storage. It’s so easy to think “We can just put it on S3/Snowflake/DynamoDB. AWS can take it” or “Just give it 4 more CPUs and 8GB more RAM and it will work” without considering to clean up the data before storage or learning how to write a more resource-optimised software. In many cases, the stored data will never be looked at again and will stay there for as long as the cloud vendor exists and the resource-hungry program will never be fixed. Just throwing more resources to a problematic software should never be your first instinct.

There are multiple reasons why this mindset has become so popular in large corporates:

  • It’s the easiest thing to do: You don’t need to deal with the issue. Everyone loves doing less.
  • The companies will pay anyway: companies paying millions of dollars in cloud costs and in many cases they don’t even feel the difference in the long run. Compared to the cost of workforce and all other licenses, millions of dollars of clouds costs could in some cases seem like the smallest cost.

# Hoarding issues

Let’s look at this issue on a personal level. We are all guilty of taking excessive amount of data on our phone just because we think one day it will be useful. Open your photo gallery and see how many unnecessary photos you have stored in there. How many are exact duplicates and how many pictures you didn’t know you have once taken?

Now go to your contacts list and see how many people there you are actively in contact with and how many you will probably never contact for the rest of your life. Once you’ve finished counting those, maybe try looking in your inbox. How many of the messages which you didn’t delete/archive you will be needing in the next 10 years?

In the past, mobile phones had limited storage. My first phone that had a camera and could play music was a Sony Ericsson K320i. It weighed ~80 grams and had 15MB of available storage for photos, music, sms messages, etc. . It had the computing power of a potato and could still run basic games.

Sony Ericsson K320i

The storage and compute limitations meant that the user had to be very careful and creative with what they store. Lossy formats like JPEG and MP3 were very influential in that period (and they still are) because we would definitely prefer having 4 full songs with low quality rather than 1 song with high quality. If a song had a long intro, you could cut the start on your computer and put the shorter version on your phone to save space! These days were all spoiled by the lossless audio types such as WAV and FLAC that are many times larger. We could only store the photos that meant something to us. A game written for that phone had to minimize compute and memory usage. Programmers in those ages had to really understand the underlying hardware and OS to be able to create something useful.

You could go back many years before my time and all of the same things applied. Everyone had to push for every bit of storage and compute because it was simply too expensive or impossible to afford more of it.

Fast forward to 2025. Your phone already has hundreds of GBs of internal storage and you can get hundreds of Gigabytes of cloud storage for a few Euros a month. in 20 years we went from 15MB to TBs stored on phones. That’s a tens to hundreds of thousand times more! And coming from those ages of limitations, of course we will just store anything because we simply now can!

# Clean your data before storage

It is very important to and clean up and process the data before storing it. The earlier in the flow of the data you do that, the less costly and more efficient it will be. For any analytical data you need an ETL-like phase that cleans up your data right after it came in and right before it is stored it in a warehouse somewhere hoping one day someone will make sense of it.

In companies that do not have a clean-data culture, most of the data that they store in a long-term storage are completely useless. The reason for that is that they’re often not governed, have no correlation and there’s no way to make sense of them. You can notice the difference in how well a company understand it’s data in their decisions. Companies with no understanding of their collected data will often not have a fact-based reasoning behind their decisions and the upper management will do their best to avoid any questions being asked. On the other side, companies with the right culture can explain their decisions and roadmaps with good confidence and statistics.

# Modern conveniences

If you go to a bakery and buy 5 different sorts of breads or pastries, they will probably put them in multiple paper packagings. Then on top of that you need to put all of the 5 separate paper packagings in a larger packaging so that you can easily take them back home with you. All of those packaging so that you walk 5mins to your home and eat all of the breads and pastries and throw the garbage in the trash can which gets emptied regularly. This is the insane amount of conveniences of the modern day.

Now if you were the only one doing that in your whole country that would not have been a problem, but imagine 100,000 people visit a bakery in a single day in your whole country, now you have multiple problems.

First of all, all of those packaging needs to be produced somewhere. So somewhere in the world, material is being extracted, mixed and formed into the packaging that can be the temporary home of a single piece of bread for 5min in their entire life. The process of making and shipping that packaging took way longer than it’s usage period.

Now that the packaging is garbage, it somehow needs to be transported and disposed, either burned or recycled. Who knows where it ends up at the end, but it’s not your problem at that point, is it?

This entire lifecyle of a small packaging is hidden from you, the bakery customer, but it exists and needs to happen perfectly so that we as modern citizens have all the comfort and our cities remain clean.

This is of course a tiny example. We could go on forever on the topic of how much waste there is in modern countries.

Now getting back to the storage and compute wastage issue, for every gigabyte of unnessary data that you store on your cloud drive or in an S3 bucket someone needs to produce, maintain and recycle the storage devices. On top of that, companies have certain SLAs such as “your data is available 99.999 of the time and 99.999999999 durable”, so for them to be able to achieve those goals they need to replicate the data on multiple storage devices in multiple locations. This is not a problem on a small scale because it creates demand for jobs and keeps the economy going forwards, but its not a sustainable practice at the global scale. To catch up with our growing demands, cloud companies have to grow exponentially and that means real damages to the world, even if they can explain with perfect arguments that their business is totally sustainable to fool the average person.

# The decline of software performance and resource consumption

Software and hardware grew very differently. While hardware made huge leaps in terms of increasing computation power and storage, our softwares got worse in terms of using those resources. Previously a whole operating system and multiple applications could run on 2GBs of RAM. Nowadays if you profile your applications under load, you may find some random web service somewhere that is serving only a few hundred requests per second and consuming 4 gigabytes of RAM and pushing a few CPU cores to their limits.

Another issue is that we got used to the poor practice of copy-pasting code without understanding it. This can happen for example because we’re super lazy beings who prefer ticking boxes rather than actually putting effort into learning something or because a manager somwehere is pushing for the product that would usually take 5 months to build to be ready in 5 days and we have to cut corners. I find it unfortunate that we became so lazy. Me too am to blame! Often times where I could take a shortcut and skip the actual learning, I’ve took the shortcut because quick results are often more rewarding in a normal 9-17 SWE job. But that’s not a good engineering culture and we should encourage each other and the next generation of software engineers to follow better engineering practices and put more time into reading and learning.

While major improvements have been made in terms of software long-term maintainability and code quality, many bad habits and poor cultural influences made us worse at writing efficient software. There are still lots of great softwares being made that perform insanely good, but those are just a small fraction of all software that is written daily. I think there has been too much focus on code readability rather than code performance and efficiency.

Things such as Clean Code that were fed to us by gurus has made us insanely worse at writing efficient software. If you see how a seasoned C++ developer writes code, you might be surprised to see that their code looks more similar to a beginners code than a mega complex, over-engineerd, overly-layered structure because simple code just performs better. Their code often has better cache locality and generally more predictible in terms of how it gets executed on the underlying hardware. The average developer almost never gets challenged to write software that maximises hardware utilisation and as a result, they will never notice the negative performance effect that “Clean Code” patterns have in their software. Most will never profile the performance of an application in their lifetime.

The average Java developer may in some cases end up with decent performance because of all the JIT optimizations but since they have no idea how that all happens, they will never learn to write a code that performs well without those JIT optimizations. This is one of the reasons why Java has been so successful. We can all write poor code and the VM takes care of it. Python and NodeJS also gave us everything we needed to get from nothing to a production-ready product in a matter of hours but if you look at the average code in those languages, they’re often about getting things to work rather than getting things to work efficiently.

OOP is another one. You may not agree with me on this, but as someone who has written mostly OOP code in their career, I think OOP languages have unintentionally taught us many bad practices and anti-patterns that would take a long time to forget and improve. Learning patterns advocated by functional programming languages and trying to understand low-level languages where memory management is more manual can greatly help you write slightly better code every day. I hope one day I build up enough knowledge to be able to write another article on this topic.

Another issue is that in the past, hardware and operating systems were so much simpler that any software developer could build up enough knowledge about the underlying hardware to be able to make more efficient software to run on it. Nowadays, hardware, Operating Systems and software frameworks became so complex and abstracted that it’s simply not possible for developers to understand them all.

All of our poorly functioning and resource-hungry modern code ends up being served on some computer on the cloud and it needs electricity and expensive resources to run. Imagine how much energy will be saved and how much money you could save if all of our software needed 10% less resources. We can unfortunately not get there easily if we keep to our current software development practices that are almost completely blind to the existence of the underlying hardware.

# Forgetting to clean up

Projects change all the time and sometimes the change involves removal of a dependency such as a database or an external paid service. It happens very often that the dependency is never actually removed and it has a lot of causes. Some reasons are: the lack of a visual overview, poor communications and sometimes people simply not caring enough about the wastage. If you dig deep enough in your organization you may find some random SaaS somewhere in the organization that no one uses but the company is still paying the subscription/license fees for. Or a database hosted on an on-prem hardware that uses 16CPUs and 40GBs of RAM and has 0 active connections.

To improve this, each team needs to actively monitor and try to remove their unused resources. At a higher level, the organization needs to encourage practices of reducing waste and create an overview of all usages and with the help of each team set up generic alerts that trigger when a resource goes out of use. In an AWS RDS example, you could listen on database connection count or CPU usage metrics. If a resource has no active connections or the CPU usage is constantly below a certain threshold, that database can be removed or downsized to reduce waste.

# “But we don’t spend that much compared to other teams”

I’ve often heard this comparison. If your team’s spending are small compared to other teams within the same organization, that doesn’t necessarily mean that you’re doing good on savings. You should compare yourself to yourself in a different time and try to improve! Other teams might be running operations that are orders of magnitude larger than your or are just really bad at their job. You should set the bar higher for yourself.

# 10$/day has a different value to your company than to someone from a poor area

Just remember the next time when you shaved off cost by a few dollars per day, you may have saved enough money to to feed an entire village somewhere else in the world. Of course we all know that that money is most probably going to go in your boss’s pocket but nevertheless, you did something positive.

# Final words

We should all start learining how to write better software that uses less resources and store less unnecessary data in the cloud. For me, personally it is still very hard to un-learn all of the bad habits from all those years of blindly coding Clean Code OOP software and to change my mindset to write software that works in perfect harmony with the underlying hardware and maximizes utilisation. But it is definitely possible to change that behaviour with lots of practice and reading.

Next time you see your software doesn’t perform well, try profiling it and understand where you can make an improvement instead of just increasing the resources for it. It’s very fun and rewarding when you manage to make such improvement. Speed of delivering software is important in the short run but the quality of software will definitely show is value or the lack of it in the long run.