Serverless vs Self-Hosted: When Each Approach Wins
Serverless is great for some workloads, terrible for others. Here's how to decide between serverless and self-hosted for each use case.
What Is Serverless?
Serverless computing runs your code in response to events without managing servers. AWS Lambda, Cloudflare Workers, and Vercel Functions are popular serverless platforms. You pay per execution.
What Is Self-Hosting?
Self-hosting runs your applications on servers you control. The server is always running, you pay a flat monthly fee, and you manage the infrastructure (or use a platform like TinyPod to manage it for you).
When Serverless Wins
Spiky, Unpredictable Traffic
A function that runs 100 times/day and occasionally 10,000 times. Serverless scales automatically and you only pay for what you use.
Simple API Endpoints
A single function that processes a webhook, transforms data, or calls an external API. No state, no database, in and out.
Event Processing
Image resizing, email parsing, log processing — tasks triggered by events that need to scale independently.
Zero Traffic Periods
If your app has hours or days with no traffic, serverless costs $0 during idle time.
When Self-Hosting Wins
Steady, Predictable Traffic
A web app with consistent traffic. Self-hosting at $5/month handles thousands of requests per second. Lambda would cost $50+ for the same volume.
Stateful Applications
Databases, file storage, long-lived connections (WebSockets), background jobs. Serverless functions are stateless and short-lived.
Complex Applications
Full web apps with databases, caches, background workers, and multiple services. Self-hosting lets you run the entire stack.
Long-Running Processes
Serverless functions have execution time limits (typically 15 minutes). Video processing, data migrations, and ML training need long-running servers.
Privacy and Compliance
Self-hosting gives you complete control over where data is stored and processed.
The Cost Crossover
Serverless is cheaper until you hit approximately 1 million function executions per month. Beyond that, a self-hosted server at $5/month is dramatically cheaper.
The Hybrid Approach
Many successful architectures use both:
TinyPod handles the self-hosted part. Use Cloudflare Workers or AWS Lambda for the serverless edges.