Approach
Serverless vs containers: where should your software run?
Once software is built, it has to run somewhere. Serverless means handing your code to a cloud provider's managed service, which runs it on demand and scales it automatically, with no servers for you to manage. Containers package your application with everything it needs and run it as a long lived service on infrastructure you configure. Both are mainstream, both run serious systems, and the right one depends on the shape of your workload.
Option A
Serverless
In a serverless setup, code runs as small functions or managed services that start when a request or event arrives and stop when the work is done. The provider handles servers, patching and scaling. You pay mainly for what runs rather than for idle capacity, which suits workloads that are spiky, occasional or event driven, such as webhooks, scheduled jobs and APIs with uneven traffic.
Strengths
- No servers to patch, size or keep running
- Scales up and down automatically with demand
- Little or no cost for idle time on quiet workloads
- Natural fit for events such as webhooks, uploads and schedules
- Fast to set up for small services and background jobs
Trade offs
- Cold starts can add delay after quiet periods
- Run time and memory limits favour short tasks over long ones
- Constant heavy traffic can cost more than a steady service
- Code becomes more closely tied to one provider's services
- Testing and debugging across many functions takes more care
Option B
Containers
A container packages an application with its runtime and dependencies so it runs the same way everywhere. Containers run as long lived services on a managed container platform or on servers you control, with capacity you choose and scaling rules you set. They suit steady traffic, long running work and applications that need full control over their environment, and they move between cloud providers with little change.
Strengths
- Runs the same way on a laptop, in testing and in production
- No practical limit on run time, so suits long jobs and steady services
- Predictable cost for constant workloads
- Portable between cloud providers and hosting options
- Full control over runtime, libraries and configuration
Trade offs
- Someone has to size, monitor and patch the environment
- You pay for running capacity even when traffic is low
- Scaling rules need to be designed and tested
- More moving parts to set up at the start
Side by side
How they compare
| Factor | Serverless | Containers |
|---|---|---|
| Who manages servers | The cloud provider | Your team, often on a managed platform |
| Scaling | Automatic, per request or event | Rules you define and tune |
| Cost pattern | Pay for use, near zero when idle | Pay for capacity, steady and predictable |
| Long running work | Better suited to short tasks | Runs for as long as needed |
| Start up delay | Possible cold starts after quiet periods | Always warm while running |
| Portability | Tied more closely to one provider | Moves between providers with little change |
| Best suited to | Spiky, event driven and occasional workloads | Steady traffic and long running services |
When serverless is the right choice
Serverless is the right choice when work arrives in bursts or on a schedule: webhooks from a booking engine or payment provider, nightly reconciliation, document processing when a file lands, or an API that is busy at month end and quiet otherwise. It keeps operating effort low, which matters for a business without its own operations team, and costs follow usage rather than sitting at a fixed level through quiet hours.
When containers is the right choice
Containers are the right choice for services with steady traffic, long running processes and anything that needs a specific environment, such as a busy customer portal, a data pipeline that runs for hours, or an application with unusual dependencies. They give predictable costs at constant load and keep you free to move providers. On a managed container platform, much of the server work is handled for you anyway.
Questions
Common questions
Is serverless always cheaper?
No. It is usually cheaper for workloads that sit idle much of the time, because you pay little when nothing runs. For constant, heavy traffic, paying per request can cost more than running a container that is busy all day. The useful exercise is to estimate your real traffic pattern and price both options against it before deciding.
What is a cold start and does it matter?
A cold start is the short delay when a serverless function runs after a quiet spell and the provider has to prepare it first. For background jobs and webhooks it rarely matters. For a customer facing page where every fraction of a second counts, it can be noticeable, and most providers offer settings that keep functions warm at extra cost. Containers avoid it while they are running.
Do we need Kubernetes to use containers?
No. Kubernetes is one way to run many containers, and it suits large systems with many services and an operations team to manage it. Most smaller systems are better served by a managed container service from their cloud provider, which runs containers, restarts them when they fail and scales them, without the overhead of operating a cluster yourself.
More comparisons
- Custom software vs no code platforms: which should you build on?
- Custom website vs template: which does your business need?
- Custom dashboards vs BI tools: which suits your reporting?
- AI assistant vs live chat: which should answer your customers?
- In house team vs engineering partner: who should build your software?
- Freelancer vs engineering partner: who should build your software?
Tell us what needs building.
Thirty minutes with the engineers who would build it. Free, no commitment.
Book a call