Carbon-Aware Software: Building Energy-Efficient Cloud Systems for the Long Term
Design and operate cloud-native systems that minimise energy and emissions, with step-by-step technical patterns and sustainable business models.

The evergreen challenge: software that limits its own carbon footprint
Digital infrastructure now accounts for a material share of global electricity demand. Engineers and technology leaders must accept that efficiency is not only a cost-saving measure; it is a durability strategy. The technical challenge is to design cloud-native applications, machine learning workloads and multi-tenant services that make operational choices aligned with energy supply, emissions intensity and long-term sustainability goals.
This article defines repeatable engineering and commercial approaches, with concrete implementation steps and code, to make software carbon-aware. These solutions are evergreen; they depend on resilient design principles, simple APIs and market mechanisms, not transient vendor features or short-lived trends.
Why this matters, forever: the UK and other jurisdictions have statutory net zero targets and regulatory pressure is increasing for measurable emissions reductions in the technology sector. For reference, the UK has committed to reach net zero emissions by 2050, a legal framework that underpins long-term planning for energy and industry https://www.gov.uk/government/collections/net-zero-strategy. Engineering teams should treat carbon as a first-class operational metric alongside cost, latency and availability.
Two evergreen solutions
Solution A: Carbon-aware infrastructure scheduling and orchestration
Concept: Make runtime placement and timing decisions based on measured or forecasted carbon intensity, geographic energy mix and real-time price signals. The result is lower operational emissions without sacrificing throughput or customer experience.
Why it lasts
- Energy supply characteristics and variability are structural; systems that adapt will produce savings year after year.
- APIs that provide carbon intensity and pricing will persist; National grids and market operators maintain forecasts and historical data.
- Scheduling and placement policies are portable across cloud, hybrid and edge deployments.
Step-by-step implementation
- Establish an emissions baseline: measure kilowatt hours consumed per service and map to grid carbon intensity for the region of execution.
- Integrate a carbon intensity feed: use a trusted API or your cloud provider's carbon metrics. For the UK and many European countries there are grid-level APIs and forecasts available from system operators.
- Label and advertise energy characteristics for compute nodes: node labels such as
carbon.forecast=low
,carbon.window=2025-11-01T14:00Z
allow orchestration layers to make placement decisions. - Implement a scheduler plugin: extend Kubernetes scheduler or your orchestrator to prefer nodes with lower expected carbon intensity, or to defer non-urgent batch work until low-carbon windows.
- Introduce soft policies: define workload classes (urgent, latency-sensitive, deferrable) and associate placement/time policies accordingly.
- Measure and iterate: track kgCO2e per request or per model-inference and refine policy thresholds to balance SLA compliance, cost and emissions.
Code example: carbon-aware batch runner and Kubernetes placement
The following example sketches a small Python service that consults a carbon intensity forecast, decides whether to run deferrable batch work now or wait, and annotates a Kubernetes Job manifest for placement on low-carbon nodes. This pattern is portable and will work with any carbon API that returns a timestamped forecast.
#!/usr/bin/env python3
# carbon_scheduler.py - simple carbon-aware runner
import requests
import datetime
import time
import subprocess
CARBON_API = 'https://api.carbonintensity.org.uk/intensity' # example national API
BATCH_JOB_TEMPLATE = 'batch-job-template.yaml'
def get_current_intensity():
# Query a simple forecast endpoint; adapt to provider if needed
r = requests.get(CARBON_API + '/regional')
r.raise_for_status()
data = r.json()
# Choose the relevant regional forecast entry; simplified for illustration
intensity = data['data'][0]['regions'][0]['intensity']['forecast']
return intensity
def should_run(intensity, threshold=200):
# threshold in gCO2/kWh; default tuned for illustration
return intensity <= threshold
def submit_k8s_job(low_carbon_tag='carbon.low'):
# Read a template, patch nodeSelector or nodeAffinity, and apply
with open(BATCH_JOB_TEMPLATE) as f:
job = f.read()
# Inject a nodeSelector for low-carbon nodes
job = job.replace('NODE_SELECTOR_PLACEHOLDER', f"nodeSelector:\n carbon-status: '{low_carbon_tag}'")
# Write patched manifest
with open('/tmp/patched-job.yaml', 'w') as f:
f.write(job)
# Apply to cluster
subprocess.check_call(['kubectl', 'apply', '-f', '/tmp/patched-job.yaml'])
if __name__ == '__main__':
while True:
intensity = get_current_intensity()
print(f"Current carbon intensity: {intensity} gCO2/kWh")
if should_run(intensity):
print('Low-carbon window detected, submitting batch job')
submit_k8s_job()
break
else:
print('Waiting for lower carbon intensity...')
time.sleep(15 * 60) # sleep 15 minutes and retry
And a minimal Kubernetes Job template snippet (batch-job-template.yaml) that uses a nodeSelector placeholder:
apiVersion: batch/v1
kind: Job
metadata:
name: batch-worker
spec:
template:
metadata:
labels:
app: batch-worker
spec:
NODE_SELECTOR_PLACEHOLDER
containers:
- name: worker
image: yourorg/batch-worker:latest
resources:
limits:
cpu: '2'
memory: 4Gi
restartPolicy: OnFailure
This pattern can be extended to use nodeAffinity, taints and tolerations, or a custom scheduler plugin for more nuanced control. The scheduler may also consult price signals or reserve capacity in advance for predictable low-carbon windows.
Solution B: Software and ML efficiency, and carbon-aware product models
Concept: Reduce energy consumption at the application and algorithmic layer; align pricing, SLAs and customer-facing features with sustainability to create resilient revenue models. Work on three levels: code and algorithmic efficiency, model deployment and inference architecture, and business model alignment.
Why it lasts
- Algorithmic efficiency is perennial; less computation means lower energy and smaller bills.
- Optimising for energy encourages code quality, observability and predictable costs; these advantages are invariant over time.
- Customers increasingly prefer sustainable vendors, making green product features a durable competitive differentiator.
Step-by-step implementation
- Profile, then optimise: use runtime profilers, sampling CPU/GPU utilisation and memory to find hotspots. Micro-optimisation rarely beats algorithmic changes.
- Adopt energy-efficient algorithms: prefer linear-time or streaming algorithms, reduce redundant data movement, and cache effectively. For ML, use quantisation, pruning and knowledge distillation to reduce inference cost.
- Change serving patterns: implement batching, asynchronous processing and serverless functions for spiky workloads to improve utilisation.
- Shift to edge or hybrid inference: run lightweight models on-device or at edge nodes for low-latency, low-energy use cases while reserving heavy training in scheduled, low-carbon times.
- Expose 'green options' to customers: allow customers to choose lower-carbon processing for non-urgent jobs at lower price points, creating demand shaping that improves utilisation and reduces emissions.
- Measure and attribute: calculate kgCO2e per feature or per API call to support product decisions and marketing claims.
Business blueprint: a sustainable SaaS pricing and feature model
Design product tiers and SLAs to reward both customers and operators for low-carbon choices. Example features and monetisation strategies:
- Green Batch Tier: cheaper for customers who accept delayed completion windows during low-carbon periods.
- Carbon Credits and Transparency: include an optional reporting add-on that allocates emissions per tenant and offers verified offset suggestions; ensure offsets are additional and high quality.
- Green SLAs: publish carbon intensity targets alongside availability and latency targets; charge premiums for faster, higher-carbon execution.
- Usage-based refunds: provide credits if a customer’s work is executed during high-intensity windows, incentivising flexible scheduling.
Financial sketch
Model the unit economics of a deferrable batch product. Suppose deferred execution reduces average compute price by 20% and lowers emissions by 30%. If compute is 30% of COGS, the resulting reduction in COGS per deferred unit is 6 percentage points, improving margins for those workloads. Crucially, this strategy reduces variable spend, makes capacity planning more predictable, and can be priced to share savings with customers while improving retention.
Comparing the solutions
- Solution A yields direct operational emissions reductions and is best for orchestrated systems where placement control exists.
- Solution B provides efficiency gains across all platforms, including those where placement is not controllable; it also produces product and revenue benefits.
- Combined approach: integrate both — schedule for low-carbon windows and make workloads themselves more efficient for compounding benefits.
Pro Tip: Tag workloads by urgency and emissions sensitivity early. When you add a new service, assign it to a workload class. This makes policy enforcement and metrics collection trivial and durable.
Did You Know?
Shifting deferrable compute from high-carbon hours to low-carbon windows can reduce a service's lifetime emissions by upwards of 20 to 40 percent, depending on the grid and workload profile. The exact saving depends on regional grid variability and the ability to batch and defer work.
Q&A: If my customers will not accept delays, what then? Use per-request options. Provide real-time execution at a premium and a low-carbon, lower-cost option for non-urgent tasks. Most platforms will find a portion of traffic that can be deferred without harming business results.
Implementation roadmap and KPIs
Adopt the following phased 6 to 12 month roadmap. The plan is vendor-neutral and works for cloud-native, hybrid and edge architectures.
Phase 0, weeks 0–4: measurement and baseline
- Instrument energy and compute metrics by service, in kWh where possible; if direct metering is not available, approximate from instance types and utilisation.
- Integrate a carbon intensity feed for the regions you operate in; store historical data for correlation analysis.
- Define workload classes and initial policy objectives, for example: urgent (no deferral), best-effort (delay acceptable), batch (delay preferred).
Phase 1, months 1–3: pilot scheduling
- Build a lightweight scheduler or controller that can defer or prefer nodes for best-effort workloads using the pattern demonstrated in the code sample.
- Run a controlled pilot with non-customer-facing workloads or internal analytics to measure emissions and cost delta.
- Collect metrics: kgCO2e per job, cost per job, success rate and latency impact.
Phase 2, months 3–6: efficiency improvements and productisation
- Apply algorithmic optimisation and model compression techniques to reduce per-inference energy usage.
- Offer green tiers and user controls for deferrable execution; monitor uptake and adjust pricing.
- Automate reporting to customers with per-tenant emissions dashboards and audit trails.
Phase 3, months 6–12: scale and governance
- Roll out scheduling across more workloads, extend to multi-region orchestration and hybrid clouds, and refine cost allocation.
- Introduce governance, carbon budgets per team and automated alerts when budgets are exceeded.
- Integrate sustainability KPIs into engineering reviews and executive dashboards.
Operational metrics and long-term governance
Track these core KPIs:
- kgCO2e per API call or per model inference; normalised to a stable unit where possible.
- Average carbon intensity at execution time for scheduled workloads.
- Percentage of deferrable work executed in low-carbon windows.
- Cost savings attributable to scheduling and efficiency (monthly and rolling annual).
Governance checklist:
- Assign a sustainability owner with a mandate to enforce carbon budgets.
- Publish measurable targets and align compensation or OKRs where appropriate.
- Require green impact statements for major product features and releases.
Warning: Do not rely solely on offsets to claim emissions reductions. Offsetting can be part of a transition plan, but primary focus should be on measurable operational reductions and transparent reporting.
Linkages and interoperability
These patterns are intentionally orthogonal to other technology concerns such as cryptography and algorithmic migration; you can, and should, apply carbon-aware patterns while executing other long-term technical initiatives. For example, a security migration such as a move to post-quantum cryptography can be planned alongside sustainability goals to avoid duplicated work and to choose low-carbon windows for compute-heavy cryptographic rekeying tasks. For guidance on structured migration planning in complex environments, see the enterprise migration framework at Enterprise Roadmap to Post-Quantum Cryptography: A Practical Migration Framework.
Case study sketch
Imagine a B2B analytics platform that runs nightly ETL and ML training jobs. After implementing carbon-aware scheduling and model distillation, the company observed a 28 percent drop in compute spend for batched workloads and a 34 percent reduction in estimated kgCO2e per month for their analytics pipeline, while retaining the same SLA for customer-facing dashboards. They monetised the change by adding a lower-cost green tier and reporting dashboards, increasing net retention by improving customer stickiness among sustainability-focused buyers.
Evening Actionables
- Run an inventory: list the top 10 workloads by compute spend and classify them as urgent, best-effort or batch.
- Integrate a carbon intensity feed for your operating regions and store hourly forecasts for 3 months for analysis.
- Prototype the scheduler: copy and run the Python example against a test cluster, create low-carbon node labels and a patched Job template.
- Measure a baseline kgCO2e per key operation and publish it internally; repeat measurement after 30 days of running the pilot.
- Create a product proposition: draft a green tier with clear SLAs and pricing that shares savings with customers.
Reusable code pointer: the carbon-aware scheduler example in this article is intentionally small, it demonstrates the architecture more than a production system. For production, implement retries, exponential backoff, API authentication, robust manifest templating and observability hooks that emit metrics to your monitoring platform. Integrate the node labelling pipeline with your CI/CD so that new nodes advertise energy characteristics automatically.
These patterns are durable because they are fundamentally about improving utilisation and aligning incentives. They help you operate cheaper, reduce regulatory and reputational risk, and unlock product differentiation that will remain relevant for years to come.
Comments ()