Principles of Green Software Engineering
principles.green
principles.green
Software that is more efficient with the network and CPU is also cheaper to run. So the incentives are generally aligned. When I deploy a system I want it to run on 5 servers not 50 for cost reasons not because I'm being green. If I'm being green by accident, that's a bonus.
I'm glad on the "measure" side it gives examples of how to measure (though I can't vouch for how good they are).
But really, as a web app developer (which is most of HN, I think) this doesn't apply "too" much beyond just increasing hardware efficiency which you'll want to do anyway. It intuitively seems graphics and GPU heavy apps are the biggest offenders.
I think that's the whole game right there -- figure out how to make sure negative externalities stop being external and become part of the cost. Then incentives will naturally align, as opposed to being at odds. In the case of your comment, you're noting they're already aligned, but overall I think many times they are not.
That's probably correct.
> Absent that, we’ll never slow our pollution enough to stop runaway warming.
But that's probably wrong. People managed to make non-polluting energy sources more compelling than the polluting ones even when the pollution is fully externalized. We will probably see a huge change on the next 20 years, and after that it will probably be better to focus on carbon capture.
What may make the first part incorrect is that focusing on intervention on the energy supply to speed-up the process may be more effective than focusing on intervention on the energy consumption. But if I had to design a policy today, I'd go almost all for the government to focus on consumption (AKA pollution taxing) and basic research.
I don't think this is true. In particular, while the price is lower for "non-polluting", we still don't have an answer for clean base load generation (well, we do--nuclear--but that seems to be off the table). Even ignoring the storage problem, I don't think we (Americans) are on track to power our entire economy with renewables by 2050. We'll probably be able to meet our current electricity demand with renewable energy by 2050, but we also need to electrify almost every other sector in our economy--most notably transportation--which means we need to generate a whole lot more electricity than we do today.
Also, if wealthy countries don't implement any kind of border adjustment, we'll just keep outsourcing our pollution to the likes of China who will happily keep burning (ever cheaper) oil.
Slow ad loading costs them more in lost revenue than the electricity used, so the incentives are still aligned.
/Devil's Champion Argument Incoming/: Facebook's part in effectively coordinating most people in most parts of the world to stay home during the pandemic has probably weighted their carbon ledger forever into the black. Or at least 5 years of dedicated bitcoin mining.
These green engineering ideas are interesting but taking them seriously would be the epitome of engineers optimizing the wrong thing.
Reading through this thread has me damn well convinced that most folks have zero idea how much power things in their homes use.
Frankly - Using my kettle to make coffee twice a day (~15 minutes of runtime) is the same as running my laptop at full power draw for 5 hours.
Just switching a single lightbulb in your house from standard (~100w) to LED (~20w) more than offsets your whole laptop's power usage, assuming you have lights on while working.
You'd still be better off turning off the lights in a single room, in most cases, or simply toggling the AC up literally 1 to 2 degrees.
Lastly, the battery power consumption varied from about 5 Watts during idling and when the screen was automatically dimmed to as high as 40 Watts under the most grueling benchmarks. On average through under load the power consumption was around 18.1 Watts.
https://www.phoronix.com/scan.php?page=article&item=dell-xps...
I don’t think a commissar can correctly compute costs of design and implementation alternatives, and I think permitting an open market and letting prices sort this out is a more viable option.
As Denis Leary used to joke, we have exercise machines that mimic normal activities which we refuse to do, so we are all turning into hamsters. Maybe instead of a leaf blower I need a broom with a better design and just count the cardio I'm going go get against my budget for the week.
Maybe, as some people argue, getting down and looking at my plants closely avoids me having to spray fossil-derived chemicals on them based on incomplete information. It's a matter of perspective on whether that time is quality or just a chore. Some cultures elevate certain chores to an art form. Japanese gardening is but one example in one niche in one cultural group, but there are many others.
However, there is also the cost of consumers needing to upgrade hardware when things start getting slow again because of these developer choices.
There’s a figure floating around that if consumers kept their phone for 1 more year, that is the equivalent of taking 100,000s of cars off the road. Not sure how reputable that study was though.
Anything you do to have even the tiniest effect on the consumption of nearly the entire world's population is going to have a large impact.
I still think it applies mostly to graphics apps and things like blockchain though. As bad as electron is... would be interesting to measure it with those tools the website lists, though.
https://twitter.com/alexhern/status/1440295741835014149
"Something that stood out: TSMC (with 55% of the global market share, per https://theregister.com/2021/06/01/q1_2021_foundry_revenue_t...) uses 5% of all Taiwan's electricity, which is approx 12TWh/yr. Bitcoin's electricity footprint is… 13 times that, at 164TWh/yr (https://digiconomist.net/bitcoin-energy-consumption)"
But maybe my next web app I'll take that into consideration.
CPU usage is a very accurate proxy of energy usage. Second to that, network traffic.
Simply ignore pages that use poor metrics.
> Whereas, say, Visual Studio for instance is on my screen 6+ hours a day.
...and some people have private jets, but this is whataboutism.
> But maybe my next web app I'll take that into consideration.
Your whataboutism comment is also off base since the comment you were replying to was asking about bloated non-browser desktop apps so my comment is very much relevant. And the parent to that comment was about software efficiency. If anything you're the one off topic.
It's fair to say: well actually they are very accurate because of CPU usage. You don't have to agree with me. But to result to ad hominem is unnecessary. Let's keep it civil.
Whataboutism is a logical fallacy where a person tries to frame the other as a hypocrite for supporting one view when another view exists.
You probably already knew that but stating it for the sake of anyone who may not.
It is used pretty exclusively by dishonest people and people who have a poor grasp of the topic. Also, to add to it, the car vs plane example is extreme to the point of being condescending. He completely dismissed my point and went straight to assuming I must be either being dishonest or ignorant.
So yes, I took that personal. Especially when my comment was not whataboutism at all, it was actually directly related to the discussion in the parent comment about desktop apps. I apologize for not just letting it go/slide.
Note that I didn't list managed languages like Java or C#. It isn't clear where they fall - they tend to defer a lot of the CPU until after the user work is done (garbage collection for example). I don't know if anyone has done any fair analysis on this so I'm going to leave it as an exercise for the reader.
A good example here may be, a machine learning model may have 90%+ of it's carbon emissions in the training, vs the operation.
It's not unusual to run an application on a server where that server is using only 25% of its resources (e.g., ram and/or cpu). Then, there are many different servers running many applications all of which are under utilized.
There are more efficient ways to operate these applications that drive up power efficiency. Google brags about the power efficiency of their data centers[1]. They do a bunch of things worth copying.
There are ways to operate software better... not just develop the apps themselves.
[1] https://www.google.com/about/datacenters/efficiency/
edited to add missing link
It's very common for someone to take all of those servers using 25% and do manual bin-packing with them. It's also common for changing features and customers to alter the resources needed after the manual process is completed, leading to further rounds of bin packing.
And every time you relocate services or hardware, there's a chance for an outage. That can become a wall you can't climb or cost you social capital every time it happens.
My general impression of Kubernetes is it's trying to solve that social problem with technology. We know how that usually goes, but any port in a storm, right?
But regarding incentive alignment, making those data centers more efficient is not just more green but also saves the companies a boatload of money.
Since cloud providers don't charge extra for your utilization percentage I've always told my teams: if the CPU is running cold either the software can use it more efficiently or we're overpaying by renting more capacity than we need.
Kubernetes is similar enough to Borg (the datacenter/cluster OS that Google uses) to efficiently schedule workloads over a cluster. There are ways to use it anyplace one has a cluster for that purpose. This is just to provide an example.
What I meant was: I can't tell AWS to make more efficient power switching or design an ASIC that is lower power. Best I can do is say that if they don't I'll move to another provider.
It's been a long time since I've worked with a company with any significant number of physical racks they rent/own where they can put their own hardware on them. Though, I admit, I may be suffering bias here and it could be they are more common and I just happen to work with companies that are cloud based.
Edit: I used to work for Lycos in the mid 2000s and we were just starting to do that (run our workload on VMs instead of metal so we could make all the servers multi-tenant. That was the last time I've worked with a physical server and the Lycos network (across all their sites) was the equivalent of a top 50 website at the time.
Websites are often offending, because they are run by the clients, so it matters less: they get bigger, with more JavaScript, maybe hosted far away, etc.
I know of Website Carbon Calculator[0] that can put a number on this for a given site.
Hypothetically, if it takes even a single week longer to make code much more efficient and only 20% of that workforce is driving to work, making coffee, running their laptops, etc, do you come out ahead?
If thousands of companies are using my library, then there really is a case to be made for making it as efficient as we can within the bounds of maintenance concerns.
For example, a SaaS app with mainly one running instance has a really low multiplier vs. a popular open source project.
All of the lifestyle changes we make that give us the warm fuzzies won't make a difference and certainly won't get us where we need to be with respect to global temperature change.
Similarly, I suspect polluters love the Democrats’ climate policy or even the Green New Deal which would have tax-payers spend trillions on programs that are tenuously related to climate (“climate justice”) rather than inhibiting polluters or making them foot the bill. Don’t get me wrong, I don’t think the Republicans would do better, but it’s really hard to see us spend trillions and not take climate seriously, all the whole smugly bragging about how we’re the ones who believe scientists.
Energy Efficiency across Programming Languages: https://sites.google.com/view/energy-efficiency-languages
I'm glad to see new(ish) languages take performance seriously: Rust, Go, Nim, Crystal, Julia. Some of the most popular languages (we all know which ones) are the least performative. But they make life easier for developers, or as programmers love to say 'more productive'. On the other hand, when it's programmers who are on the receiving end of slow, resource intensive apps, they'll complain loudly.
When performance is an issue in running programs, a common response is: hardware is cheap, just add another energy-guzzling server or use a more powerful computer.
This attitude is embarrassing when you consider that in every other industry there is a push for reduced resource usage and lower energy consumption. I don't think it's controversial to say a typed, compiled language gives you good performance for free (and the reduced computing resources that implies).
Aside: When PHP 7 was released, Rasmus Lerdorf, the creator of PHP, said the performance improvements meant fewer servers, smaller memory use and reduced CPU activity - all of which equalled less power or electricity consumed. (And remember this is an interpreted language.)
When you consider the millions of servers in use, that additional language efficiency adds up to a substantial saving in electricity use. You can watch a segment from his presentation below where he talks about this, including the calculations he made of potential CO2 savings:
Rasmus Lerdorf – "PHP in 2018" (extract from the 15 min mark): https://youtu.be/umxGUWYmiSw?t=15m16s
https://solar.lowtechmagazine.com/es/2020/08/how-sustainable...
There is so much bandwidth used because of that (I've seen the numbers for some projects and it's HUGE).
JFrog gets the artifacts on premises, but causes issues trying to get them to the build agent. The opportunity costs of having false negatives and positives from CI builds are simply not worth it.
To me, softwares are the greenest inventions ever.
Most of the big cloud providers already are implementing agendas to become sustainable:
- https://sustainability.aboutamazon.com/environment/the-cloud... AWS is planning to be carbon neutral by 2025
- https://cloud.google.com/sustainability, Google claims to be carbon neutral now but are also planning to switch to 100% renewable energy by 2030. I guess they are planting trees or something.
- https://azure.microsoft.com/en-us/global-infrastructure/sust... Azure is planning to using 100% renewable energy by 2025
Otherwise, maybe optimize your cost with cloud usage and indirectly save some energy. If you don't need it and it's running, it's costing you and the planet something. So, win win if you fix that. Also, as MS helpfully suggests, on premise is way more inefficient than their solution. While that is somewhat self serving, it's also probably true. If you us on premise, maybe consider picking your energy supplier more carefully.
I guess, in the future, having strong guarantees from suppliers about sustainability could potentially mean advertising your own sustainability. Few companies do this right now. But it's potentially a big deal when your customers start appreciating, or better, demanding that you run your business sustainably. Right now, few companies care about this. It's a mindset change that needs to happen.
* During its production: mining to get the metals, heavy metal work like making steel, cement, resins, etc. Digging large mines, driving trucks all around with heavy materials
* During its operations: noise, visual pollution, often destroying wildlife sites as people don't want them close to their living areas
* After its operations: mostly unrecyclable, composite materials like resins, cement; often burried/landfilled
> Google claims to be carbon neutral now but are also planning to switch to 100% renewable energy by 2030. I guess they are planting trees or something.
I think this is a good representation of what the common person think. "They must be dealing with the pollution issues, right? Trees, hydrogen, electric cars, it's all going to be ok, right?".
Start looking up data on this topic, and prepare for a deep dive into how no-one is actually doing anything significant about it, while calling everything green. No-one is "carbon neutral". It's complete marketing / green-washing. Google footprint on our ecosystem is large.
What is the best material you found on "full comprehensive costs (including downsides and externalities) of energy sources"?
Here is a talk he did for the MIT media lab in english: https://youtu.be/s254IPHXgVA
The UK's mostly solved this by putting turbines a couple miles off the coast. And the benefit of having that renewable energy vastly outweighs the environmental impact of "noise".
Would it really make a difference for the average project? Honest question.
Is an example website that I enjoyed that shows you how much carbon you’re effectively saving by viewing their low impact version for each request.
https://lowimpact.organicbasics.com/eur/collections/all-mens...
You have to click on the images to actually see the real clothes you'd like to buy. I understand green/eco but I wonder who would ever use a website like this to buy any kind of (physical) goods? It kills entirely the UX and obviously it saves the company money in terms of cpu/memory/bandwidth used.
What about the costs of me having to go back and forth to see all the items one by one, therefore triggering more pages views? What about the mobile experience?
I browsed around for about 5 minutes and apparently saved 153.74g. A Dutch person's average yearly emissions mount to about 9 metric tonnes.
Very.. very roughly that's 15% of my hourly emissions.
Considering I'd be very unlikely to order from a website like this, just imagine what we're saving on logistics in addition to that! :)
Joking aside, the impact is infinitely larger than I had expected. It could also be that my quick math is off.. I'll have to check later.
so many inefficient systems/languages/algorithms are being used at scale, it is really disheartening. For instance, Python is the Ford F250 double cab dually of the software engineering world.
Right now Microsoft has already written Windows 11.
All that's left is for them to decide how much of an anti-reuse & anti-recycling effort they want to mandate this time across the virtually captive worldwide PC hardware resources.
One simple bonehead decision will determine how much perfectly good already-manufactured hardware will or will not be allowed to support Windows 11, or will need to be replaced un-necessarily.
The difference between requiring new hardware versus no new hardware at all is probably a lot greater at this scale than the difference between substituting a Volkswagen for every Ford F-250.
Also note that people are carbon so I read Principle 1 as reduce the amount of people (seats and time) it takes to make the software and make the apps quick to use so people don't waste time waiting on them.
Let me stop this right there. We as software engineers have to stop turning a blind eye to the impacts of the actual businesses our code is for. It isn't "green software engineering" if the businesses we are helping are by design net negative for the environment.
Don't help the ad industry create more needs that don't increase well-being, either directly by working for them or via monetization of some other service. Don't work for surveillance capitalists. Don't build software for industries selling vanity commodities or ones that are based on planned obsolesence. In general, make sure the purpose of your code isn't to accelerate overconsumption.
After that is taken care of, these are solid points.
In many houses the TV is using more power than the fridge, and in some cases more than your old fridge did.
My partner also complains about lights or leaving the fridge door open while I fetch food or drink from several containers, but then leaves the TV on counting on it to turn itself off (in an hour).
I think I'm going to have to explain conductivity and heat capacity, and remind everyone that I replaced all of the lights in the house with LEDs (some of which were goddamned expensive).
Coincidentally I found a thread recently (in French) claiming that it was more energy-efficient to watch Netflix than broadcast TV: https://twitter.com/pbeyssac/status/1439977593315512320