green-coding-solutions / eco-ci-energy-estimation

Eco CI Energy estimation for Github Actions Runner VMs
MIT License
48 stars 10 forks source link

Consider changing the default cron to day instead of night for lower carbon impact #32

Closed liamlaverty closed 9 months ago

liamlaverty commented 11 months ago

Hey, love the action thank you for creating it!

Could the default cron time be moved to the daytime, instead of midnight? The marginal unit of energy at night time typically generates more carbon than during the day, due to the lack of solar power. As such, the action in its default form creates excess demand for high-carbon energy sources.

Longer-term, would you consider integrating with the Carbon Aware SDK from Green Software Foundation? https://greensoftwarefoundation.atlassian.net/wiki/spaces/~612dd45e45cd76006a84071a/pages/17137665/Opensource+Carbon+Aware+SDK, integrating this feature would automatically move the action's time around, depending on the carbon intensity of the energy mix.

ArneTR commented 11 months ago

Hey Liam, thanks for raising the issue!

I think you raise a valid point here, especially to highlight the possibility of savings through time shifting.

I want to however also include the other opinions on the topic. Have you for instance read Adrian Cockrofts piece on the possible downsides of this approach? https://adrianco.medium.com/dont-follow-the-sun-scheduling-compute-workloads-to-chase-green-energy-can-be-counter-productive-b0cde6681763

The other downside, which is in most grids the case, is that even if typically the mix is greener during the day there might be no actual saving in the concrete instance of the run due to rather the marginal energy sources (gas here in germany) being used to satisfy additional demand.

Very much interested on your views on both points.

If we change the time for the default cron I would argue we should at least provide both arguments in the docs :)

liamlaverty commented 11 months ago

Hi Arne, That's an interesting set of discussions, thanks.

Looking through Cockroft's piece, and the linked GSF github thread[1] there's still a lot of debate about marginal versus average unit of energy being the main thing to target. I've tried to summarise below:


I'm not too sure what I think now. Running a tool like Carbon Aware SDK might be a good idea to defer the strategy to that organisation. However it'd come as a substantial change to the Action, and would incur ongoing maintenance for your team down the line. From Cockroft's article, "cron-jittering" might be the most impactful & simplest change, just moving it away from the "on the hour" approach when all the other crons are increasing computation demand.

[1] https://github.com/Green-Software-Foundation/sci/discussions/351 [2] https://adrianco.medium.com/dont-follow-the-sun-scheduling-compute-workloads-to-chase-green-energy-can-be-counter-productive-b0cde6681763 [3] https://github.com/Green-Software-Foundation/sci/discussions/351#discussioncomment-4936341 image