News for hackers. Stuff that matters.
Re:Principles of Green Software Engineering by throwaway2016a on Wednesday September 22, 2021 @08:47AM (#28615679)
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.

Re:Principles of Green Software Engineering by anyonecancode on Wednesday September 22, 2021 @09:23AM (#28616012)
> 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.

Re:Principles of Green Software Engineering by throwaway894345 on Wednesday September 22, 2021 @09:43AM (#28616225)
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.
Re:Principles of Green Software Engineering by marcosdumay on Wednesday September 22, 2021 @11:41AM (#28617637)
> 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.

Re:Principles of Green Software Engineering by throwaway894345 on Wednesday September 22, 2021 @12:06PM (#28618023)
> 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.

Re:Principles of Green Software Engineering by pjc50 on Wednesday September 22, 2021 @09:32AM (#28616115)
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.
Re:Principles of Green Software Engineering by londons_explore on Wednesday September 22, 2021 @11:17AM (#28617314)
Adtech as a whole totally earns far more revenue than the electricity cost to run all that client side javascript.

Slow ad loading costs them more in lost revenue than the electricity used, so the incentives are still aligned.

Re:Principles of Green Software Engineering by pjc50 on Wednesday September 22, 2021 @11:47AM (#28617737)
I don't think this is proven either way. The only research I am aware of is https://ris.utwente.nl/ws/files/5095958/Hidden-Energy-Costs.... which puts ads at about 3.4% of PC web browsing energy use, but that's not a financial number.
Re:Principles of Green Software Engineering by bcrosby95 on Wednesday September 22, 2021 @12:13PM (#28618123)
They put ads at requiring an extra 2.5w of energy. You can use that to directly calculate the cost from your local electricity rates.

For me, the calculation is: 2.5w / 1000 * 28 cents = 0.07 cents per hour.

Re:Principles of Green Software Engineering by BoxOfRain on Wednesday September 22, 2021 @08:51AM (#28615714)
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?
Re:Principles of Green Software Engineering by musingsole on Wednesday September 22, 2021 @09:20AM (#28615975)
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.

Re:Principles of Green Software Engineering by horsawlarway on Wednesday September 22, 2021 @09:31AM (#28616096)
I agree 100%.

Reading through this thread has me damn well convinced that most folks have zero idea how much power things in their homes use.

Re:Principles of Green Software Engineering by BoxOfRain on Wednesday September 22, 2021 @12:49PM (#28618608)
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!
Re:Principles of Green Software Engineering by pdimitar on Wednesday September 22, 2021 @11:06PM (#28624845)
Which power meter did you use?
Re:Principles of Green Software Engineering by BoxOfRain on Monday September 27, 2021 @04:42AM (#28668454)
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.
Re:Principles of Green Software Engineering by horsawlarway on Wednesday September 22, 2021 @09:11AM (#28615882)
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.

Re:Principles of Green Software Engineering by anonymoushn on Wednesday September 22, 2021 @09:27AM (#28616057)
How many laptops does it run on all day, and does anyone run it on desktops instead?
Re:Principles of Green Software Engineering by horsawlarway on Wednesday September 22, 2021 @09:34AM (#28616130)
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.

Re:Principles of Green Software Engineering by jhgb on Wednesday September 22, 2021 @09:52AM (#28616327)
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.
Re:Principles of Green Software Engineering by pjc50 on Wednesday September 22, 2021 @09:17AM (#28615942)
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.
Re:Principles of Green Software Engineering by horsawlarway on Wednesday September 22, 2021 @09:21AM (#28615982)
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.

https://www.phoronix.com/scan.php?page=article&item=dell-xps...

Re:Principles of Green Software Engineering by jawache on Thursday September 23, 2021 @11:28AM (#28630611)
If your application is used by 1 million people, does your equation become a lot more interesting?
Re:Principles of Green Software Engineering by sk2020 on Wednesday September 22, 2021 @10:18AM (#28616568)
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.

Re:Principles of Green Software Engineering by hinkley on Wednesday September 22, 2021 @12:24PM (#28618292)
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.

Re:Principles of Green Software Engineering by sokoloff on Wednesday September 22, 2021 @09:11PM (#28624122)
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.
Re:Principles of Green Software Engineering by sseagull on Wednesday September 22, 2021 @09:13AM (#28615903)
My guess is not much.

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.

Re:Principles of Green Software Engineering by whbrown on Wednesday September 22, 2021 @09:33AM (#28616118)
That simply reflects the fact that 5.5 billion is 55,000 times larger than 100,000.

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.

Re:Principles of Green Software Engineering by throwaway2016a on Wednesday September 22, 2021 @08:55AM (#28615759)
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.

Re:Principles of Green Software Engineering by BoxOfRain on Wednesday September 22, 2021 @09:03AM (#28615835)
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".
Re:Principles of Green Software Engineering by pjc50 on Wednesday September 22, 2021 @09:15AM (#28615921)
Ran across this earlier today:

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)"

Re:Principles of Green Software Engineering by goodpoint on Wednesday September 22, 2021 @08:59AM (#28615805)
Tons, unsurprisingly. There are website energy calculators around.
Re:Principles of Green Software Engineering by throwaway2016a on Wednesday September 22, 2021 @09:05AM (#28615845)
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.

Re:Principles of Green Software Engineering by goodpoint on Wednesday September 22, 2021 @01:24PM (#28619114)
> I've always been skeptical of those.

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.

Re:Principles of Green Software Engineering by throwaway2016a on Wednesday September 22, 2021 @05:14PM (#28621914)
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.

Re:Principles of Green Software Engineering by sokoloff on Wednesday September 22, 2021 @09:20PM (#28624187)
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.
Re:Principles of Green Software Engineering by throwaway2016a on Wednesday September 22, 2021 @11:21PM (#28624907)
Assuming that is a legitimate question:

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.

Re:Principles of Green Software Engineering by bluGill on Wednesday September 22, 2021 @02:10PM (#28619691)
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.

Re:Principles of Green Software Engineering by vaughanknight on Thursday September 23, 2021 @11:37PM (#28638362)
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.

Re:Principles of Green Software Engineering by mfer on Wednesday September 22, 2021 @09:34AM (#28616128)
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.

[1] https://www.google.com/about/datacenters/efficiency/

edited to add missing link

Re:Principles of Green Software Engineering by hinkley on Wednesday September 22, 2021 @12:18PM (#28618203)
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?

Re:Principles of Green Software Engineering by throwaway2016a on Wednesday September 22, 2021 @09:38AM (#28616172)
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.

Re:Principles of Green Software Engineering by mfer on Wednesday September 22, 2021 @09:44AM (#28616233)
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.

Re:Principles of Green Software Engineering by throwaway2016a on Wednesday September 22, 2021 @10:06AM (#28616447)
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.

Re:Principles of Green Software Engineering by jiehong on Wednesday September 22, 2021 @02:10PM (#28619689)
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.

[0]: https://www.websitecarbon.com