SD Core

Serverless Architecture

Run functions or containers on demand — no server management, auto-scale to zero, pay per invocation.

Interview tip Lead with a 30-second definition, then one real system example and name 2–3 designs where Serverless Architecture is non-negotiable.

① What it is (30 seconds)

Run functions or containers on demand — no server management, auto-scale to zero, pay per invocation.

② How it works in system design

API Gateway → Lambda/Cloud Functions. Cold start latency trade-off. State in external DB/S3. Good for bursty, event-triggered work. Limit execution time and memory.
Typical placement
ClientEdge / GatewayServerlessServicesData stores

③ Concrete system design example

Scenario: Image thumbnail on upload: S3 event triggers Lambda, generates sizes, writes back to S3. Zero cost when no uploads; scales automatically on viral spike.

④ Important interview Q&A

QuestionAnswer
Cold start problem?Provisioned concurrency, smaller runtimes (Go/Rust), or warm pools for latency-sensitive paths.
When not serverless?Long-running streams, WebSocket chat rooms, steady high QPS GPU inference.
Stateless rule?All state in DynamoDB/S3; function instance is ephemeral.

⑤ Seen in these system designs

In interviews, after explaining the concept, say: "This shows up directly in …" and link two designs.

⑥ Revision checklist

  • Trigger source
  • Cold start awareness
  • State externalized
  • Timeout limits
  • Cost model
serverlesslambdacloud