← Study Notes Cloud


Cloud

Serverless

Run code as functions (Lambda, Cloud Functions) with no servers to manage — the platform scales from zero to thousands automatically and you pay only per execution. It is ideal for spiky, event-driven or glue workloads. The trade-offs are cold-start latency, execution and time limits, and vendor lock-in through proprietary triggers.


Purpose

Serverless runs your code as functions (AWS Lambda, Cloud Functions) or containers (Cloud Run) without any server for you to manage: the platform provisions, scales from zero to thousands of instances, and bills per invocation. Idle costs nothing; spikes need no capacity planning.

When to Use It

Event-driven glue (process an upload, react to a queue message, handle a webhook), APIs with spiky or unpredictable traffic, scheduled jobs, and edge functions in front of a site — anywhere paying only for actual execution beats paying for standing capacity.

Trade-offs

Cold starts add latency to the first request after idle; execution time, memory and payload limits shape what fits; long-running or steady-load workloads can cost more than a plain VM. Proprietary triggers and services are the real lock-in, and local testing takes extra tooling.

Implementation

Keep functions small and stateless with state in external stores; connect them via managed triggers (HTTP, queues, schedules, storage events). Watch cold-start-sensitive paths (provisioned concurrency where needed), set timeouts and retries deliberately, and make handlers idempotent — the platform retries on failure.