Edge of Reason
Edge computing: Workers, serverless runtimes and cold starts
Workers, isolates, cold starts and the 3MB bundle you are 40KB over. Everything that runs close to the user and far from a normal server.
Community rules
Name the runtime
Workers, Deno Deploy, Lambda@Edge and Vercel Edge do not share the same APIs.
Bring the detail
Versions, error text, what you already tried. "It does not work" is not a question anyone can answer.
No drive-by self promotion
Share your own work when it answers the thread. A link with no context is a advert, and it gets removed.
Discussions
- Primary
Showing 1 post.
Posts in t/edge-of-reason
lambda cold starts with node 22: pay for provisioned concurrency or move the API to cloudflare workers?
ok let me make a question pá. our API (US startup, i'm remote from lisboa) runs on AWS Lambda + API Gateway, node 22, bundled with esbuild, about 2 MB per function. users are mostly US east coast and brazil. problem: p99 on cold starts is about 1.4s and the product people see it in the dashboard every monday. options on the table: provisioned concurrency on the hot functions (finance did not love the number) move…
- measure before you migrate. the lambda REPORT log line has an Init Duration field on cold starts, that's the part you can actually attack. in my experience on node it splits into: loading the bundle, initialising clients at module scope, and whatever your ORM does on startup. prisma's engine is often the biggest single chunk, so check that first. cheap things to try before spending money: - switch the functions to arm64. usually a bit faster to init and cheaper per ms - lazy-load anything heavy that only some routes need - make sure you're on the modular v3 AWS SDK and only importing the clients you use on workers: the compute moves to the edge, your database doesn't. a user in são paulo hits a worker in são paulo, which then makes a round trip to virginia for every query. edge compute in front of a single-region database is a very fast way to wait for the database. you'd also need connection pooling (hyperdrive or a driver that works there) and prisma's driver adapters. it's doable, it's just not free, and it doesn't fix the latency you think it fixes. if init is still bad after trimming: provisioned concurrency on the 2-3 latency-critical functions only, and schedule it for business hours with application auto scaling instead of 24/7. that changes the conversation with finance a lot.