Lesson 3 / 32
When Serverless Fits and When It Does Not
Decide whether a workload suits serverless, containers or long-running servers using load shape, duration and team constraints.
By Rahul Agarwal · 15 years in web development
Good fits, poor fits and the middle ground
Serverless fits spiky or unpredictable traffic (a college fest registration page that is quiet for months, then floods for two days), event-driven glue (resize an image when it is uploaded, react to a payment webhook), scheduled jobs, and small teams that want to avoid operations work. It fits poorly when work is long-running (functions have maximum durations, for example 15 minutes on Lambda), when load is steady and high (an always-busy server can be cheaper than per-invocation billing), when you need special hardware or a single process holding long-lived connections, or when you need consistently low tail latency and cold starts would hurt. Managed container platforms sit in the middle: you package a whole server but still let the platform scale it. A practical decision starts with three questions: how bursty is the load, how long does one unit of work take, and who will be on call for the servers?
Caterer versus running your own kitchen
For a once-a-year family function you hire a caterer and pay per plate. If you feed 500 people every single day, running your own kitchen becomes cheaper, even though you must hire cooks and maintain the stoves. Serverless is the caterer: perfect for bursts, not always cheapest for constant volume.
A quick checklist before choosing
- Work unit finishes in seconds, not hours? Serverless is fine.
- Traffic idle most of the day? Scale-to-zero saves money.
- Needs GPUs, huge memory or a permanent socket server? Prefer containers or VMs.
- Sustained heavy load all day? Price both options before deciding.
- No one wants to patch servers? That counts as a real cost too.
Quick check: Which workload is the weakest fit for a typical FaaS platform?
- Generating a thumbnail whenever a photo is uploaded
- A nightly job that emails a short summary report
- A video transcoding job that runs for two hours per file on steady, round-the-clock input
- An API for a contest site that is idle except during contest weekends
Answer
A video transcoding job that runs for two hours per file on steady, round-the-clock input — Function duration limits and constant high utilisation both work against FaaS. The other three are short, event-driven or bursty: classic fits.