Problem
We’re seeing intermittent 3–7s TTFB execution time on SSR admin routes. We’ve instrumented our middleware and handlers, and the app code is consistently fast (~100–400ms). The spikes appear to happen before the function starts executing.
Evidence
- Response headers show low app time:
X-App-Timing: total ~120–460msX-Instance-Uptime: high (e.g. 100–200s) → not a cold start
- Yet browser TTFB is 3–7s for the same request.
- Running the same app on a cheap Hetzner VPS (always‑on
Node) eliminates the spikes entirely.
Example response headers:
x-app-timing: admin_start;dur=0.15 … total;dur=123ms
x-instance-uptime: 185s
x-vercel-cache: MISS
What we tested
- Verified API calls are fast (100–200ms).
- Added server timing headers and measured hydration; hydration is <1s.
- Cached stats endpoint for 10 minutes to reduce load (no change in spikes).
cURLtests show the same URL can be 7s then 0.6s next run.- VPS test shows no long tails.
Environment
- Framework: Astro SSR
- Adapter:
@astrojs/vercel - Compute: Fluid compute, hot function
Question
Any suggestions on reducing the pre‑execution latency spikes? Happy to share x-vercel-id values if helpful.