Cold starts feel like dark magic until you measure them. For a team serving users in India off a function deployed in a US region, the first request after idle was routinely crossing a second — and the loudest complaints came from exactly the low-traffic endpoints that go cold most often. We stopped guessing and started instrumenting every cold invocation separately from warm ones.
The biggest single win was shrinking the deployment bundle. A function that drags in a heavyweight SDK, a date library, and an ORM pays an initialisation tax on every cold start. We replaced broad imports with narrow ones, moved non-essential work out of the module scope, and let tree-shaking do its job. Smaller artifact, faster boot.
The second win was placement. Pinning functions to a region close to users (bom1 for India) cut the network round-trip that cold starts make worse. We also moved connection setup into a reusable singleton so a warm container did not re-open a database handshake on every call.
Key takeaways
- Measure cold and warm invocations separately; you cannot fix what your average latency hides.
- Shrink the function bundle by importing only what you use and keeping module-scope work minimal.
- Pin latency-sensitive functions to a region near your users (for India traffic, a Mumbai region).
- Reuse database and HTTP connections via a module-level singleton instead of reconnecting per request.
- Consider keeping critical endpoints warm with a light scheduled ping rather than over-provisioning everything.
Practical checklist
- Add a log field that tags each invocation as cold or warm and chart the split.
- Run a bundle analyzer on your heaviest function and remove the largest unused dependencies.
- Confirm every function's deployment region matches where the majority of requests originate.
- Move client and pool initialisation to module scope so warm containers skip the handshake.
What to do next week
Cold starts are rarely one problem; they are three or four small ones stacked together. We have profiled and trimmed serverless APIs for teams shipping from India to global users, and we are glad to spend a short call looking at your cold-versus-warm numbers to find the few changes that will move your p99 the most.
How we work with clients at TechTrio
Every engagement at TechTrio Automation starts with a short discovery phase: we map your current stack, traffic, conversion paths, and operational bottlenecks. From there we propose a phased roadmap — quick wins first (tracking, analytics hygiene, performance, or a focused automation), then deeper builds (product modules, integrations, or marketing systems). Our teams in Ahmedabad and Mehsana collaborate closely with stakeholders in India, the UK, USA, Canada, and the UAE, so documentation, handoffs, and support hours stay practical.