10 ms·
Principles of Green Software Engineering
- anonymoushn 5y agoIt 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
- the-dude 5y agoUntil I did a year of Plone development, I always thought webapps were IO bound.
- deleted 5y ago[deleted]
- krono 5y agoNone of the websites or posts on this topic that I've come across contain any numbers. Would it really make a difference for the average project? Honest question.
- jasoncabot 5y agohttps://lowimpact.organicbasics.com/eur https://lowimpact.organicbasics.com/eur 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.
- mk89 5y agoThat's a really interesting product/website. I just looked at: https://lowimpact.organicbasics.com/eur/collections/all-mens-products 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?
- pelasaco 5y ago"We use cookies to save energy, reduce data transfer and gather statistics."
- krono 5y agoThanks, that's a very interesting resource. 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.
- throwaway2016a 5y agoIt 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.
- anyonecancode 5y ago> 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.
- pjc50 5y agoIn 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.
- londons_explore 5y agoAdtech 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.
- pjc50 5y ago
- marsven_422 5y agoSounds like something for the diversity hires.
- OscarCunningham 5y agoIf only we had a carbon tax, these could all be replaced with 'save money'.
- throwaway894345 5y agoI 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.
- johnthescott 5y agoyep. change requires energy. taxation is traditionally how government addresses such social costs.
- davidw 5y agoI think this is the right answer. Otherwise, there are just too many variables to juggle.
- PoissonVache 5y agoMy 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.
- pjc50 5y agoI'd want numbers for that; youtube is fairly efficient, especially on a mobile device. 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 https://twitter.com/pbeyssac/status/1439977593315512320
- Torwald 5y agoCorrect 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.
- burkaman 5y agoThe 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.
- oytis 5y agoNow 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)
- hinkley 5y agoThe 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).
- ericb 5y agoI 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?
- throwaway894345 5y agoUnless 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).
- adrianN 5y agoNot buying stuff you don't need and the like are measures and individual can take that don't have hidden carbon downsides.
- scoopdewoop 5y agoShaming 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.
- throwaway894345 5y agoBut 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 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.
- yitchelle 5y agoWorked 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!
- agustif 5y agoGo solar, or go home https://solar.lowtechmagazine.com/es/2020/08/how-sustainable-is-a-solar-powered-website.html https://solar.lowtechmagazine.com/es/2020/08/how-sustainable...
- mfer 5y agoI'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).
- hinkley 5y agoI 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.
- jillesvangurp 5y agoInstead 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://sustainability.aboutamazon.com/environment/the-cloud?energyType=true https://sustainability.aboutamazon.com/environment/the-cloud... AWS is planning to be carbon neutral by 2025 - https://cloud.google.com/sustainability 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/sustainability/#overview 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.
- lwouis 5y agoThere 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.
- lincpa 5y ago10 Principles of Scientific Software Engineering https://github.com/linpengcheng/PurefunctionPipelineDataflow#Principles-of-the-model https://github.com/linpengcheng/PurefunctionPipelineDataflow...
- ttiurani 5y ago> 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.
- kodah 5y agoThis 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.
- Terretta 5y agoComputational 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.
- fnord77 5y agoI'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.
- fuzzfactor 5y agoNot 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.
- sergiotapia 5y agoThought experiment: what would happen to energy and pollution if magically, all existing software on earth suddenly was written in high performing C?
- open-source-ux 5y agoThe 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: Energy Efficiency across Programming Languages: https://sites.google.com/view/energy-efficiency-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://youtu.be/umxGUWYmiSw?t=15m16s
- exdsq 5y agoDoes 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.
- guilhas 5y agoSo no more Electron apps
- sylvainr65 5y agoI 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.
- jquast 5y agoWhat is the carbon footprint of the extra carriage return character in DOS and Windows text files?
- axilmar 5y agoIt's too late to replace all of text protocols with binary ones and redo everything in C like languages.
- johnthescott 5y agopay the power bill on the dc running your code.