The other day I tried to calculate how many servers run 24/7 just to serve ads nobody clicks.
I didn't find the exact number. But I know it's obscene.
The elephant in the server room
The tech industry consumes about 4% of global energy. Seems small until you remember it's more than all civil aviation.
And what do we do with this energy?
- Train AI models to generate pictures of cats wearing hats
- Mine cryptocurrencies backed by faith
- Serve personalized ads you ignore
- Stream 4K videos on a 6-inch phone
I'm not judging. I also watch Netflix in 4K. But it's worth thinking about.
The code we write
Every line of inefficient code is wasted energy. Multiplied by millions of executions, it becomes burnt forest.
# This runs every hour, on millions of servers
for user in all_users: # N queries
send_notification(user)
# vs
users = get_all_users() # 1 query
send_bulk_notification(users)
The difference seems small. But when you multiply by scale, by time, by datacenters around the world...
Micro-optimizations that matter (at scale)
- Lazy loading — don't load what the user won't see
- Compression — fewer bytes, less energy to transmit
- Cache — computation that doesn't need to happen again
- CDNs — data closer to the user, less distance to travel
Nothing revolutionary. Good practices that are also green practices.
The uncomfortable question
Every project should start with: does this need to exist?
Not every problem needs an app. Not every app needs microservices. Not every microservice needs Kubernetes.
Sometimes the most sustainable solution is a spreadsheet. Or a conversation. Or simply not doing it.
What I do (and don't do)
I won't pretend I'm carbon neutral. I run servers, use cloud, my dev setup consumes energy.
But I try to:
- Turn off what's not in use
- Choose cloud regions with renewable energy
- Avoid over-engineering (fewer services = less consumption)
- Question if the feature really needs to exist
The paradox
The technology that causes the problem can also solve it. Route optimization reduces fuel. Smart grids save energy. Sensors prevent waste.
Code can be part of the solution. But first it needs to stop being part of the problem.
I don't have answers. Just the feeling that we should think more about this while writing that nested loop.