Cloud Functions (GCP)
Google Cloud's event-driven, single-purpose compute service, the most granular and shortest-lived compute unit in GCP's compute spectrum. It fits a narrow niche compared to Cloud Run - a specific triggered action like resizing an uploaded image, rather than a full application with multiple routes and business logic.
Frequently Asked Questions
Where does Cloud Functions fit relative to Cloud Run and Compute Engine on GCP's compute spectrum?
Cloud Functions sits at the most granular, most ephemeral end — a single function triggered by a single event (a file upload, a Pub/Sub message, an HTTP call), with no routing, no multi-endpoint app structure. Cloud Run runs full containerized applications with multiple routes and arbitrary business logic, still serverless and scale-to-zero but a broader unit. Compute Engine gives full VM control for anything needing persistent state, custom OS-level configuration, or long-running processes neither serverless option supports well.
What's a common cost or performance mistake with Cloud Functions?
Using Cloud Functions for a workload that's actually a full application with several routes, and ending up deploying a separate function per endpoint — this multiplies cold-start overhead across every route independently rather than sharing one warm runtime, and complicates shared state or connection pooling (like a database connection) that would be trivial in a single long-running container. Once a 'function' grows past a single narrow triggered action, it's usually a signal to move it to Cloud Run instead.