← Docs
Recipe

Serverless cold-start mitigation

Keep your Vercel functions warm so users never wait on a cold boot.

Problem

Serverless functions spin down after inactivity. The next request pays a cold-start penalty — container init, dependency load, connection setup — often 200–800 ms before your code runs.

Strategy

Ping your own API route on a cron schedule. Vercel Cron Jobs (free tier: 1/min) keep one instance warm. For multiple regions, deploy a lightweight health endpoint and call it from edge functions distributed across your target geographies.

Implementation

// vercel.json
{
  "crons": [
    {
      "path": "/api/keep-warm",
      "schedule": "*/5 * * * *"
    }
  ]
}

// app/api/keep-warm/route.ts
export async function GET() {
  return Response.json({ ok: true, ts: Date.now() });
}

Caveats

  • Cron warms one instance per deployment, not per region.
  • Hobby plan allows 1 cron job; Pro unlocks 40.
  • Combine with ISR revalidation for data-layer warmth.

Meridian tip: Layer this with our edge-probe agent to measure cold-start percentiles across your fleet.