Card 06/ 10
Serverless Architecture: Functions Run on Demand
No servers to manage, billed per call, and no memory kept between calls.
In a serverless architecture, code runs as functions that a cloud platform starts when an event arrives, such as a request or a file upload, and stops when they are idle. You deploy functions, not servers: the platform decides where they run and how many copies, and you pay for the calls and the time they run rather than for machines.
What it makes easy. No servers to patch, size or scale: a thousand requests at once start many copies, and none at night costs nothing. It suits work that arrives in events, such as resizing an image when it is uploaded, and teams that would rather not run infrastructure.
What it makes hard. A request that finds no running copy waits for a cold start, from a fraction of a second to a few seconds depending on the runtime and package size. A function keeps no memory between calls you can rely on, so all state lives in a database or cache. There are limits: an AWS Lambda function runs for at most 15 minutes. And at a steady high load, paying per call can cost more than servers running all the time.
Use it when
- Work arrives as events, unevenly, with idle periods
- Each job is short and needs no memory between calls
- A small team would rather not run servers
Avoid it when
- Load is steady and high, so per-call pricing exceeds servers
- Every request must be fast, so a cold start is unacceptable
- Steps pass large data between many functions
A company known to use it, and to leave it. Amazon Prime Video built a tool that monitors the quality of video streams from AWS Step Functions and Lambda. Data passed between many steps cost more than the work, and in March 2023 the team described moving it into a single process, cutting its infrastructure cost by over 90% (Marcin Kolny, Prime Video Tech, 2023).
So use serverless for short, uneven, event-shaped work, and count the cold starts and the per-call cost before using it for steady, heavy load.
← → move through sections and cards