Why it matters
Serverless functions eliminate ops for glue code and event handlers. For workloads that fit, cost is a fraction of always-on VMs.
The architecture
Two generations: Cloud Functions 1st gen (Node-only originally, expanded runtimes) and 2nd gen (Cloud Run under the hood, more languages, longer timeouts, larger memory).
Trigger types: HTTP (invoked by URL), background (Pub/Sub, GCS, Firestore, Auth events). Each function is deployed with a specific trigger.
How it works end to end
Cold starts happen on new instances. Runtime, memory allocation, and package size all affect latency. Minimum instances setting keeps some warm.
Concurrency (2nd gen): each instance can handle multiple concurrent requests, reducing cold starts under load.
Runtime environment provides HTTP framework auto-wiring, JSON parsing, and integration with GCP services via default credentials.