Tech Tip #63: Add an energy check to CI

Your CI catches slow code. Does it catch hungry code?

Video created by explainapaper.com

The problem

Pipelines test correctness and sometimes performance, but energy regressions slip through for months. The research shows energy checks in CI are feasible; almost nobody runs them.

The fix you can use today

  • Measure a fixed scenario's energy in CI on the same runner every time.
  • Set a threshold and flag builds that exceed it.
  • Repeat runs to separate a real regression from noise.

GreenCode researchers found that energy checks can run in CI just like speed checks, but few teams do it.

Tools that help

  • Eco CI: estimates the energy of CI pipeline runs on GitHub Actions and GitLab, per step
  • Green Metrics Tool: measures the energy of whole software scenarios run in containers, so runs can be repeated and compared
  • GreenFrame: measures the footprint of a web application's user scenarios and enforces carbon budgets in CI

How GreenCode helps

GreenCode helps tackle this by building the test scenario for you: a load test generated from the system's own endpoints that records energy as well as speed and ranks the hotspots by energy. More on this.

Tags

#ci-cd#testing#measurement

Sources

Transcript

Your CI catches slow code. Does it catch hungry code? Pipelines test that code works, and sometimes how fast it is. But an energy regression can slip through for months. It keeps burning energy from the day it ships. GreenCode researchers found that energy checks can run in CI, just like speed checks. But few teams do it. Here is the fix you can use today. Pick one fixed scenario, and measure its energy in CI. Tools like Eco CI, the Green Metrics Tool or GreenFrame can do this. Use the same runner every time. Set a limit, and flag any build that goes over it. Run it more than once, to tell a real regression from noise. Caught at merge, it costs almost nothing to fix. GreenCode helps tackle this by building that scenario from your system's own endpoints. It records energy as well as speed, and ranks the hotspots by energy. That was GreenCode Tech Tip number sixty-three. Follow for the next tip, and find more on greencode.ai/tech-tips.

All GreenCode Tech Tips · All GreenCode videos

  • Tip #63
  • For Ops and infrastructure
  • Length 1:04
  • Category Testing, CI and code quality
GreenCode

Want this checked on your own system? Talk to the GreenCode team.

Get in touch