Cut your server response time

Get time-to-first-byte under 500ms with caching and a CDN.

30–60 min

why this matters

Server time is pure dead time: nothing renders until the first byte arrives, so it delays every other metric on the page.

Step by step

  1. 1

    Put a CDN in front of the origin

    Cloudflare, Fastly or your host's built-in CDN serves cached pages and assets from a location near each visitor. This alone usually halves response time for far-away users.

  2. 2

    Cache full pages where you can

    For pages that don't change per visitor, set an explicit cache header so the CDN can serve them without touching your server.

    Cache-Control: public, max-age=60, stale-while-revalidate=600
  3. 3

    Find the slow query

    Enable slow query logging in your database and add indexes for the columns your slowest queries filter and sort on. One missing index is the usual culprit.

  4. 4

    Add object caching

    Cache expensive computed values and API responses in Redis or your framework's cache layer instead of recomputing them on every request.

how to check it worked

  • TTFB under 500ms from a region far from your server
  • Repeat requests report a CDN cache hit
Re-scan my site

related guides