GC

Google Cloud Functions

Serverless compute, cold starts, and event-driven triggers

Details

Language / Topic
gcpGoogle Cloud Platform
Category
Infrastructure

Rules

balanced
- Keep Cloud Function deployment boundaries small to minimize cold start times.
- Use global variables to cache initialization logic and database connections across invocations.
- Minimize cold start times by keeping deployment package sizes small and lazy-loading heavy dependencies inside the handler.
- Cache initialization logic, database pools, and HTTP clients in global variables outside the function scope to reuse them across warm invocations.
- Ensure all background promises are resolved before returning a response or the instance may be frozen mid-execution.