Tech Tip #17: Serve static sites from the edge

A page view shouldn't need a database.

Video created by explainapaper.com

The problem

Content sites often run an application server and a database for every page view, even though the pages change rarely.

The fix you can use today

  • Pre-render pages that rarely change as static files.
  • Serve them from a CDN or edge network with long cache lifetimes.
  • Keep server-side code only for things that really are dynamic, like forms.

GreenCode moved its own website from WordPress to static pages served from the edge.

Tools that help

  • Greencheck (Green Web Foundation): checks whether a domain is hosted on renewable-powered infrastructure
  • CO2.js (Green Web Foundation): an open-source library that turns bytes transferred into an estimate of CO2, using the Sustainable Web Design model
  • WebPageTest: loads a real page and shows every request, its size and when it loaded

How GreenCode helps

GreenCode helps tackle this by proving it on greencode.ai first: static pages on an edge network, WebP images and scripts only where used. A first view of the home page fell from 6,766 KB over 80 requests to 1,719 KB over 33. More on this.

Tags

#cdn#caching

Sources

All GreenCode Tech Tips

  • Tip #17
  • For Ops and infrastructure
  • Category Web and front-end
  • Format short video
GreenCode

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

Get in touch