It seems most of these boil down to: build more efficient software.
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.
> 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 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.
Honestly, the number one thing any of us can do for the climate is to contact our representatives regularly about climate pricing. Absent that, we’ll never slow our pollution enough to stop runaway warming. Everything else is a micro optimization that may even distract us from the only thing that will get us over the line.
> the number one thing any of us can do for the climate is to contact our representatives regularly about climate pricing
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.
> 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.
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.
In particular, there are all sorts of incentives for adtech to burn CPU on the _client_, which doesn't cost them anything. It's entirely possible to burn 0.1cent of electricity to earn 0.001cent of ad revenue.
I do wonder how many kW of power things that HN generally disparages as bloated (Electron being the main one people talk about) actually adds up to versus more efficient technologies?
If the result or information presented by the most horrendous, energy inefficient, blockchain-backed, cloud replicated app results in a SINGLE person NOT traveling for a weekend, the carbon savings would completely demolish any cost for the software overhead.
/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.
It's interesting, I've been planning to move onto a sailing yacht for a while and part of the planning process has involved figuring out an energy budget which will inform what batteries and charging equipment (solar panels etc) are required to run a WFH (WFB?) setup. I bought a simple plug-in power meter and I was very surprised by the power usage of some things in my life!
Sorry, didn't see this. It was just a cheap plug-in one off Amazon, probably cost around £20 or so. It does watts, amps, volts and I think AC frequency too.
I think you're firmly into the realm of diminishing returns by the time you're trying to optimize code that runs on a laptop that has a total power draw of 60ish watts.
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.
Even a desktop only runs about 100w unless you're doing something like gaming. Admittedly, a desktop guarantees you're using another screen, so tack on 60w for the external monitor.
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.
If I remember correctly, my desktop runs at ~20W idle (went down to 15W before I added two extra memory modules) and ~70W fully loaded. That's a 50W delta per eight cores, so around 7W per fully loaded core.
The laptop power draw is dynamic depending on what you're doing with it, including how heavy the webpages are. But I agree that heating will generally dominate domestic use.
Sure, but I'm being exceedingly generous with 60w, assuming a modern device that's about the limit of power consumption. To quote phoronix benchmarks on my machine:
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.
I think you could end up in a quagmire of trying to calculate all the secondary effects of different production strategies. Maybe another GUI framework uses less power, but maybe it takes more developer hours. How much power do those workstations consume? And their offices or home offices? Or the power consumed by hosted services they use? What about the power to heat their coffee? What country are the developers in and how is their power sourced? Is a kWh of Chinese coal comparable to a kWh of US natural gas?
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.
One of the elephants in the climate crisis room is coming to grips with how many watt-hours are appropriate to spend on a task that could be completed with human power alone.
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.
The primary fossil (nat gas) derived chemical is nitrogen. No amount of you fussing over the plants is likely to replace or substantially diminish their need for nitrogen. It can avoid using weed control products, which are overwhelmingly not fossil-sourced.
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.
That's a good point I didn't think of. And one that I think also applies to a lesser extent to websites. It is certainly possible to build a website that makes Chrome use a lot of CPU and network data.
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.
Yeah my gut feeling is that Bitcoin alone trounces any waste caused by Electron and badly written webapps, but it'd probably still be worth measuring I think. At the very least it'd be another argument on the side of "let's not use Moore's Law as an excuse for writing inefficient software".
I've always been skeptical of those. Especially the ones that do things like measure the brightness of the pixels. For the amount of time someone tends to spend on a single page it seems like optimizing just one page is like a water dropper in an ocean. Whereas, say, Visual Studio for instance is on my screen 6+ hours a day.
But maybe my next web app I'll take that into consideration.
That second part of that comment was very unnecessary. Please don't do that on HN, I even threw you a bone at the end and said:
> 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.
Where was the ad hominem attack? Unless the other poster somehow happens to know you have a private jet (which no one else would reasonably know unless you just got oddly defensive about it), I can’t see it.
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.
You have options as a developer. Instead of python/php/perl/ruby (and hundreds of others most of which I don't know) you can write your server side code in C/C++/rust/ada/ (again hundreds of others). You will spend a lot more energy compiling and debugging your code up front, but in the long run you will use less energy on all the server. But will you - every time you roll out an update there are a lot more compiler hours on the developer machines, and less on the server time to amortize it over.
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.
In addition there is a need to look at the total cost including supporting functions. Dev test servers, build pipelines, redundancy, failover, deployment environments. Sometimes these may be 5% of emissions, but at other times much higher. And some languages will have significantly less emissions when idle.
A good example here may be, a machine learning model may have 90%+ of it's carbon emissions in the training, vs the operation.
I think there's something missing here. In how we operate applications.
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.
Pre-cloud it was always pulling teeth to get new hardware provisioned. You had to get past the guy who has realized his only power is saying no by refusing to write checks, and then you have to get IT to provision the box, and there may be physical layout issues that complicate doing that in the best way possible.
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?
Most companies don't have control over their data centers (except to maybe use energy efficiency as a selection criteria). But you have a point about CPU.
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.
A lot of companies still have control their data centers or some portion of them. At least to an extent to control how things are scheduled on hardware.
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.
I agree, you can architect your system to make better use of hardware for sure.
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.
This only applies if you are the one running your own software.
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.
I wonder if this might be penny wise and pound foolish.
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?
The XKCD comic on these needs a separate column for open source.
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.
Unless we have systemic change (e.g., border adjusted carbon tax), anything we try to do as individuals is going to be penny wise and pound foolish. Most of our carbon footprint comes from industry (including transporting goods). Much of that presumably comes from our trade with China both in terms of their lax pollution laws and then transporting goods across the Pacific. None of that is going to change unless we stop pretending that pollution is free, which is to say we need to pass some carbon pricing scheme so that companies have an incentive to reduce the amount of pollution in the goods they sell us. Greener items will inherently be cheaper, and it will give local manufacturing a competitive advantage (bringing back jobs).
But they don't even amount to a rounding error. It might be a big personal sacrifice to give up your SUV or meat or whatever, but you shouldn't delude yourself into thinking you're doing anything for the environment because it's not even a drop in the ocean. It's literally negligible, immeasurable, etc. The only thing we can reasonably do is lobby our legislators for carbon pricing, including giving or volunteering with http://citizensclimatelobby.org.
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.
You are right of course, I also don't think that individual action is terribly meaningful. I just wanted to address the "penny wise, pound foolish" part. Fractional pennies can be saved by individuals without expending pounds of carbon elsewhere.
Shaming individuals for consumption confuses the political reality around us. It does nothing to actually bring about material change, and distracts from the real causes. Besides that, its tedious and rude.
I often feel that all of these “personal responsibility” initiatives are distractions from passing a carbon tax as well. Polluters have a long history of campaigning for personal responsibility solutions so they can continue polluting (going back to the “Crying Indian” ad in the 70s). Of course I think everyone should lower their carbon footprint, but we’re never going to come close without carbon tax and border adjustments. Of course if you’re writing your legislators regularly to advocate for a carbon tax and writing Green Software or eating vegan or whatever, then great, but by far the best use of your time is contacting your politicians.
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.
The topic of ranking programming languages by energy efficiency has been discussed before on Hacker News. Here is the paper previously discussed which has been updated in 2021:
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:
I'm reminded of the waste many CI sets do. Where they download the same set of dependencies at the same versions for each run. No effort put into caching thing.
There is so much bandwidth used because of that (I've seen the numbers for some projects and it's HUGE).
I have to turn off caching because it doesn't play well with our JFrog cache.
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.
This reads like the ultimate goal is writing computationally efficient software. The key tool to measuring non-performant code would be asymptotics and specifically Big Omega and Big Theta, because you need to shrink the total window size as well as shift it down. Engineers hate being evaluated on whether they know Big O, much less we hardly test on Big Theta. Secondary to that, it's increasingly difficult to find engineers who even have a general mastery of asymptotics and algorithmic efficiency.
I don't follow. We wrote fax softwares that eliminated the need to buy a fax. We wrote accounting softwares that eliminated the need to have hundred of accountants to get to the office every day, using cars! We wrote softwares that eliminated the need to sell and buy physical encyclopedias, dictionaries, watches, photo albums, typewriters, books, compasses, maps, calculators, tickets, cameras, VHS, calendars, answering machines, telephones, flashlights, radios, newspapers, agendas, snail mail, sound systems, physical money. We wrote softwares that get anything delivered to your door without having you getting in your car and spending hours in 3 physical stores. We wrote softwares that make it possible to share your neighbor car for a little fee. We wrote softwares that can assess climate changes effects.
To me, softwares are the greenest inventions ever.
Instead of micromanaging performance and energy usage; use data centers that use clean energy. It's dirty energy that we need to stop using. Clean energy, we should feel less constrained about (without wasting it obviously). Long term when we have a surplus, it shouldn't matter how much we use. Short term, increased demand actually grows the renewable supply mostly because that is the cheapest way to meet that demand. The more renewables, the less economical non renewable becomes. So, not all energy usage is bad.
Most of the big cloud providers already are implementing agendas to become sustainable:
- 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.
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.
There is no such thing as "clean energy". Energy always entails environmental impact. As an example, a wind turbine has large environment impact:
* 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.
You can try talks from this guy, he's a french energy and climate expert. I found that he explained very well the root of the issue between growth, energy and climate impact.
> During its operations: noise, visual pollution, often destroying wildlife sites as people don't want them close to their living areas
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".
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've been having the same so of thoughts for a few years. glad someone is writing this down.
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.
Not only languages & energy requirements but accelerated hardware obsolescence.
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.
Computational efficiency is great, but Principle 6, "Reduce the amount of data", is out of place. Where data is information and informed decisions are better decisions, less data results in worse decisions and inevitably more energy usage down the line. So something is wrong or some qualification is missing in this phrase.
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.
Worked on a project where if our product exceeds a power consumption threshold, we would be penalised financially. x dollars per kilowatt per month per instance.
It adds up fast!
> These eight principles form a shared understanding of what it means to be a Green Software Engineer independent of: Application domain, Industry...
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.
It seems hard to achieve most of these goals independent of programming language and framework. At Facebook, the Instagram team has built tooling to inform engineers how many millions of dollars each line of their Python code costs to execute, but the easiest way for them to save those dollars and Joules is to not run back APIs used by billions of people with Python
Does this really matter to a "normal" software engineer? Or is this something that only really matters to the cloud engineers at AWS and the hardware engineers at Intel? I'd like this to be real but I'm sceptical it's just fluff.
My mom keeps bothering me to turn off the light before I leave home while any of the Youtube video she watch costs as much energy as keeping my light on for days/months.
If only people were more aware of the energy cost of Internet.
Now I feel really old, but your mom probably remembers time when a bright lightbulb would consume twice as much energy as a modern laptop (which was like 10-15 years ago)
Correct me if I am wrong, but I think saving energy is the wrong overall way to go. Better is to be 100% renewable (or otherwise "green") when generating energy, so that consumption ceases to be an issue.
The right thing is to do both, because we don't have time to relax and wait for the grid to be 100% renewable. Using less energy means we can convert the grid more quickly.
The power budget on big screen TVs has snuck up on people and doesn't get enough air time.
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).
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.