Skip to main content

Performance

How to Improve Time to First Byte (TTFB)

TTFB is the time from clicking a link to receiving the first byte of HTML. Anything over 800ms is a problem. The fixes are upstream from your application code.

Try our Speed test

Put a CDN in front of everything

Cloudflare Fastly Bunny — even free CDNs cut TTFB dramatically by serving from edge nodes geographically close to the user.

Cache HTML at the edge

If your HTML can be cached for even 60 seconds the average TTFB drops to <50ms. Use stale-while-revalidate to serve stale HTML while revalidating in the background.

Render at the edge

Edge runtimes (Vercel Edge Cloudflare Workers Deno Deploy) execute server logic close to users. A 300ms TTFB on a centralized server becomes 30ms on the edge.

Optimize the database query

If pages are dynamic the slowest part is often a database query. Add an index denormalize cache in Redis or move to a read-replica close to your edge runtime.

Want to verify your setup?

Run the check now