Skip to content
Back to Blog
Hosting Support9 min read

When to Use Serverless: 5 Real Decision Points

A practical decision tree for engineering teams weighing serverless against containers and traditional hosting based on actual workload patterns, cost predictability, and control needs.

Written by Abdul AbrorTechnical Hosting Support Engineer
When to Use Serverless: 5 Real Decision Points
On this page

Choosing between serverless, containers, and traditional hosting is less about chasing trends and more about matching your workload to the right infrastructure model. I've watched teams migrate to serverless only to migrate back six months later because the pricing model didn't align with their actual traffic. I've also seen the opposite—teams running $400/month VPS instances for workloads that would cost $12/month on Lambda.

The decision isn't binary. Most production systems end up using a mix. But you need clear criteria to decide which pieces belong where.

Decision Point 1: Traffic Predictability and Volume

Serverless shines when traffic is spiky or unpredictable. If your endpoint gets hit twice a day or 20,000 times in ten minutes with nothing in between, you don't want to pay for idle capacity.

A typical case: webhook receivers. GitHub webhooks, Stripe payment notifications, third-party API callbacks—these fire irregularly and need to scale instantly. Running a dedicated container or VM for something that executes 50 times a day is expensive overkill.

Containers make more sense when traffic is steady and you can predict baseline load. An API serving 500 requests per minute around the clock will likely cost less on a right-sized container cluster than on serverless, especially once you cross the free tier thresholds.

Traditional VPS hosting works when traffic is moderate and consistent. A WordPress blog getting 10,000 visits a day runs happily on a $20/month VPS. Moving it to serverless adds complexity without saving money.

Quick checkpoint: If your traffic graph looks like a heartbeat monitor, consider serverless. If it looks like a gently rolling hill, containers or VPS will probably cost less.

Decision Point 2: Execution Duration and Resource Requirements

Serverless functions have time and memory limits. AWS Lambda caps execution at 15 minutes. Google Cloud Functions at 60 minutes. If your workload runs longer, serverless isn't an option.

Memory allocation ties directly to cost. A function configured for 10GB of RAM costs proportionally more per millisecond than one using 512MB. For memory-intensive tasks like video transcoding or large dataset processing, you'll hit cost ceilings fast.

I handled a ticket once where a team tried running PDF generation on Lambda. Each PDF took 8-12 seconds and needed 3GB of memory. They were burning through $800/month for something that ran fine on a $40 container with persistent storage.

CPU-bound vs I/O-bound workloads

Serverless works well for I/O-bound tasks—calling APIs, querying databases, reading/writing files. The function sits idle during network waits and you only pay for active CPU time.

CPU-bound tasks are different. Video encoding, image processing, complex calculations—these peg the CPU at 100% for their entire execution. You pay for every millisecond, and there's no cost advantage over a dedicated instance running the same code.

Containers give you more control here. You can fine-tune CPU and memory independently, use GPU instances for specific workloads, and optimize for sustained throughput rather than burst capacity.

Litmus test: If your code spends most of its time waiting on network or database calls, serverless might fit. If it spends most of its time crunching numbers, look at containers or VMs.

Decision Point 3: State Management and Cold Starts

Serverless functions are ephemeral. Every invocation might start in a fresh container with no memory of the previous run. You can't rely on in-memory caching, local file storage, or open database connections persisting between requests.

Cold starts hit hardest when traffic is sporadic. The first request after idle time takes longer—sometimes much longer—while the provider spins up a new execution environment. For user-facing APIs, a 2-3 second cold start is unacceptable.

Provisioned concurrency solves this by keeping functions warm, but you pay for that idle capacity. At which point you've reinvented a container that's always running.

Containers maintain state between requests. You can cache data in memory, keep database connection pools open, and optimize for subsequent requests. For applications that benefit from warm caches—like content APIs or session-heavy apps—this matters.

When statelessness is an advantage

Sometimes statelessness is exactly what you want. Background job processors, ETL pipelines, and event handlers often work better when each invocation is isolated. No shared state means no race conditions and no memory leaks accumulating over time.

A cron job that runs every hour to sync data between systems? Serverless. A WebSocket server maintaining thousands of persistent connections? Not serverless.

Decision Point 4: Cost Predictability and Budget Constraints

Serverless pricing is consumption-based. You pay per request and per compute-second. For low-volume workloads, this is cheap. For high-volume workloads, it scales linearly with traffic.

The problem is predictability. A traffic spike from a viral post or an API abuse incident can multiply your bill by 10x overnight. I've seen functions accidentally called in tight loops rack up thousands of dollars before anyone noticed.

Containers and VMs have fixed monthly costs. You pay the same whether you serve 10,000 requests or 10 million (up to the point where you need to scale up). This makes budgeting straightforward.

Hidden costs in serverless

Data transfer charges add up. Egress from Lambda to the internet isn't free. API Gateway has its own per-request fees. Logs shipped to CloudWatch cost money. A "serverless" architecture can have 4-5 different line items on your cloud bill.

Vendor-specific services lock you in. You can't easily move Lambda functions with DynamoDB Streams and Step Functions orchestration to another provider. Containers running in Kubernetes are far more portable.

Budget rule: If you can't afford a 3x spike in your hosting bill without advance notice, serverless needs careful guardrails. Set billing alarms and rate limits.

Decision Point 5: Operational Complexity and Team Skills

Serverless reduces operational overhead. No OS patches, no load balancer config, no autoscaling rules. You write code and deploy. The provider handles the rest.

This matters for small teams. A two-person startup can run production infrastructure on serverless without a dedicated ops person. The same workload on Kubernetes requires significantly more expertise.

But serverless introduces different complexity. Distributed tracing across dozens of functions is harder than tracing a monolith. Debugging cold starts and intermittent timeout issues requires cloud-specific knowledge. Local development often involves mocking half the cloud provider's services.

Containers sit in the middle. You manage orchestration and infrastructure, but the application environment is consistent from local development through production. Teams with ops experience often find containers more predictable.

Control vs convenience

Serverless abstracts away the server. That's the point. But abstraction means less control. You can't SSH into a Lambda function to debug. You can't install custom system libraries easily. You can't tune kernel parameters or optimize network stack settings.

For most applications, that control isn't necessary. But when you need it—for compliance requirements, performance optimization, or specialized tooling—serverless becomes a constraint.

Traditional hosting gives you root access and complete control. The tradeoff is that you're responsible for everything. Security patches, monitoring, backups, scaling—all on you.

Team checkpoint: If your team knows containers well, don't force a serverless migration just because it's trendy. If you're starting fresh and want to ship fast, serverless removes a lot of infrastructure decisions upfront.

What actually works in production

Most real systems use hybrid architectures. API routes that get hit constantly run in containers. Background jobs and webhook handlers run serverless. Static assets serve from a CDN. Batch processing jobs run on spot instances or Fargate tasks.

The engineering team I support runs this mix: core API on ECS containers, email sending via Lambda triggered by SQS, image resizing on Lambda with S3 events, and admin dashboard on a small EC2 instance. Each piece uses the model that fits its workload.

Start with the simplest option that meets your needs. A VPS is simpler than containers, which are simpler than serverless in many ways. Add complexity only when the tradeoffs justify it—when you're paying too much for idle capacity, when scaling is too slow, or when operational overhead becomes a bottleneck.

Don't migrate your entire stack at once. Pick one isolated workload—a background job, a webhook receiver, an image processing pipeline—and test serverless there. Measure actual costs and performance before going all-in.

Questions teams should answer first

Can you predict your monthly request volume within 50%? If yes, fixed-cost hosting is probably cheaper. If no, serverless scales more safely.

Do you need sub-second cold start performance? If yes, serverless will cost more because you'll pay for provisioned concurrency or need to re-architect.

Does your code need more than 15 minutes of execution time? If yes, serverless isn't an option. Use containers or VMs.

Are you comfortable with vendor lock-in? Serverless ties you to specific cloud providers more than containers do. This might not matter for your use case, but it's worth considering.

What does your team already know? Learning curve has real cost. If your team is productive with Docker and VMs, the productivity hit from learning serverless architecture patterns might outweigh the infrastructure benefits.

Where to start your evaluation

Run the numbers on your current workload. How many requests per day? Average execution time? Memory usage? Put those numbers into pricing calculators for Lambda, Fargate, and EC2. The difference is often larger than you expect—in either direction.

Profile one typical workload in detail. Is it CPU-bound or I/O-bound? How long does it run? Does it need state between requests? The answers will push you clearly toward one model.

Most importantly, match the infrastructure to the problem. Serverless isn't inherently better or worse than containers or VMs. It's a tool that fits certain workloads perfectly and others poorly. The teams that get this right are the ones who choose based on their specific traffic patterns, cost constraints, and operational reality—not based on what's currently trendy.