Skip to content
← All posts

Debugging a 3-second TTFB in Next.js

1 min read#nextjs #performance

The symptom

Every page took three seconds to start streaming, even static ones.

Finding the cause

A fetch in the root layout had no caching, so it ran on every request and blocked the whole tree.

app/layout.tsx
const settings = await fetch("https://api.example.com/settings");

The fix

Moving the call into a cached function brought time to first byte under 200ms.