Tech Tip #36: Let quiet services scale to zero

Why run a service all night for zero requests?

Video created by explainapaper.com

The problem

Services with bursty or office-hours traffic run at full size around the clock because autoscaling was never set up, or has a minimum of several replicas.

The fix you can use today

  • Add autoscaling matched to demand instead of static provisioning.
  • Use event-driven scaling (for example KEDA) to scale idle workloads to zero.
  • Measure cold-start cost and keep one warm replica only where latency needs it.

Tools that help

  • GreenCode Constitution skill (GreenCode researchers): open-source energy principles and a catalogue of 37 energy anti-patterns that an AI coding agent can follow to find and fix waste like this
  • KEDA: event-driven autoscaling for Kubernetes, including scaling a workload to zero when there is nothing to do
  • Kepler: exports energy estimates per pod and container on Kubernetes, using eBPF and hardware counters

How GreenCode helps

GreenCode helps tackle this by mapping a running estate, including services that barely run at all. It rebuilds the estate as infrastructure as code and attributes energy and CO2e to the services that cause it. More on this.

Tags

#kubernetes#autoscaling#serverless#idle

Sources

Transcript

Why run a service all night for zero requests? Some services are busy in bursts, or only in office hours. But they run at full size, day and night. Often nobody set up autoscaling. Or the minimum is set to several copies. So you pay for peak capacity all the time, and it all draws power. Here is the fix you can use today. Add autoscaling that follows demand, instead of a fixed size. Use event-driven scaling, like KEDA, to take quiet services down to zero. Measure the cost of a cold start. Keep one warm copy only where speed really needs it. The Green Software Foundation suggests scaling workloads down when they are quiet. GreenCode takes this into account. GreenCode's Constitution skill can help an AI coding agent fix this waste. Then scale on events and check each pod's energy, using tools like KEDA and Kepler. GreenCode helps tackle this by mapping your running systems, including services that barely run. It rebuilds them as code, and shows which services use the energy. That was GreenCode Tech Tip number thirty-six. Follow for the next tip, and find more on greencode.ai/tech-tips.

All GreenCode Tech Tips · All GreenCode videos

  • Tip #36
  • For Ops and infrastructure
  • Length 1:14
  • Category Containers, Kubernetes and serverless
GreenCode

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

Get in touch