Tech Tip #47: Cache at every layer

Why send the same bytes a million times?

Video created by explainapaper.com

The problem

Responses that rarely change are regenerated and re-sent on every request: no cache headers, no CDN, no application cache.

The fix you can use today

  • Set Cache-Control headers on static assets, with long lifetimes and versioned file names.
  • Put a CDN in front of static content.
  • Cache expensive query results in the application where they can go slightly stale.

GreenCode researchers list missing caches as an energy waste to fix.

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
  • WebPageTest: loads a real page and shows every request, its size and when it loaded

How GreenCode helps

GreenCode helps tackle this by scoring a codebase against quality, security and green software patterns in one pass, so a missing cache comes out as a ranked defect alongside the bugs and security findings. More on this.

Tags

#caching#cdn#web-performance

Sources

All GreenCode Tech Tips

  • Tip #47
  • For Developers
  • Category Web and front-end
  • Format short video
GreenCode

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

Get in touch