What is Serverless Computing?
Learn what serverless computing is, how FaaS and cold starts work, and when it beats always-on servers — with a DevOps interview answer.
Expected Interview Answer
Serverless computing is a cloud execution model where the provider fully manages the underlying servers, provisioning, and scaling, so developers deploy code as discrete functions or services and are billed only for the actual compute time consumed, not for idle server capacity.
Despite the name, servers still exist — "serverless" means the developer never provisions, patches, or manages them directly; the cloud provider automatically allocates resources when a request or event arrives and tears them down afterward. The most common serverless model is Function-as-a-Service (FaaS), where individual functions are triggered by events like an HTTP request, a queue message, or a file upload, and each invocation runs in an isolated, ephemeral execution environment. Because environments can be torn down completely between invocations, a “cold start” occurs when a new environment must be initialized before the first request is served, adding latency that provisioned, always-warm servers do not have. Serverless is well-suited to spiky, event-driven, or infrequent workloads where paying only per-invocation beats paying for an always-on server, but it is less suited to long-running, latency-critical, or highly stateful workloads without careful design.
- Eliminates server provisioning and OS patching overhead
- Bills only for actual execution time, not idle capacity
- Scales automatically from zero to many concurrent invocations
- Speeds up development for event-driven and spiky workloads
AI Mentor Explanation
Serverless is like a cricket academy that hires a specialist coach on-demand for exactly the duration of one net session, rather than keeping a full-time coach on payroll every single day whether players show up or not. The academy is only billed for the minutes the coach actually spends coaching, not for the coach sitting idle between sessions. If no coach has worked with a player in a while, the very first session of the day takes a few extra minutes to get the coach briefed on that player’s style, similar to a cold start. This model works brilliantly for occasional specialist sessions but poorly for a player who needs a coach present continuously all day.
Step-by-Step Explanation
Step 1
Deploy the function
Upload code as a discrete function/service; no server provisioning is required from the developer.
Step 2
An event triggers execution
An HTTP request, queue message, or file upload invokes the function.
Step 3
Provider allocates resources
The provider spins up (or reuses) an isolated execution environment and runs the code.
Step 4
Scale to zero and bill per use
The environment tears down after execution; billing reflects only actual compute time consumed.
What Interviewer Expects
- Understanding that serverless still involves physical servers, just abstracted away
- Knowledge of the FaaS event-trigger model
- Awareness of cold starts and their latency impact
- Ability to identify when serverless is and is not a good fit
Common Mistakes
- Claiming serverless means “no servers exist” instead of “servers are provider-managed”
- Ignoring cold-start latency when discussing tradeoffs
- Assuming serverless is always cheaper regardless of workload shape
- Not distinguishing serverless functions from serverless containers/platforms
Best Answer (HR Friendly)
“Serverless means we write our code as small functions and the cloud provider handles all the server management, scaling, and patching for us — we only pay for the exact time our code actually runs. It is great for workloads that spike unpredictably, since we are never paying for idle servers sitting around waiting for traffic.”
Code Example
Resources:
HelloFunction:
Type: AWS::Serverless::Function
Properties:
Handler: index.handler
Runtime: nodejs20.x
MemorySize: 256
Timeout: 10
Events:
ApiEvent:
Type: Api
Properties:
Path: /hello
Method: getFollow-up Questions
- What causes a cold start and how can it be mitigated?
- When would you choose serverless over containers on Kubernetes?
- How does serverless billing differ from a traditional provisioned server?
- What are the limitations of serverless for long-running processes?
MCQ Practice
1. In serverless computing, who manages the underlying servers?
Servers still exist, but the cloud provider provisions, patches, and scales them, hiding that work from the developer.
2. What is a “cold start” in serverless computing?
When no warm environment is available, the provider must initialize one first, adding latency to that invocation.
3. Serverless billing is typically based on what?
Serverless platforms bill based on actual execution time and resources consumed per invocation, not idle capacity.
Flash Cards
What is serverless computing? — A model where the provider manages servers and bills only for actual execution time.
Does serverless mean no servers exist? — No — servers exist but are fully abstracted away and managed by the provider.
What is a cold start? — Added latency when a fresh execution environment must initialize before serving a request.
What workloads suit serverless best? — Spiky, event-driven, or infrequent workloads rather than long-running or latency-critical ones.