DeployWise
HomeBlogServerless vs VPS
ComparisonServerlessVPSCostPerformance

Serverless vs VPS in 2026: The Real Cost & Performance Comparison

Serverless sounds great on paper: no servers to manage, auto-scaling, pay-per-use pricing. But the reality at scale tells a different story. We break down real costs at 100K to 1M requests, measure cold start latency, and show you exactly when a VPS wins.

Mar 15, 2026
14 min read

The serverless vs VPS debate, settled with data

The “serverless vs VPS” question is one of the most common architectural decisions developers face in 2026. Serverless platforms like AWS Lambda, Vercel Functions, and Cloudflare Workers promise zero infrastructure management. VPS providers like Hetzner, DigitalOcean, and Vultr offer raw compute at a fixed monthly cost. Both are valid choices, but they serve fundamentally different use cases.

This guide compares them on the metrics that actually matter: real-world cost at different traffic levels, request latency including cold starts, architectural constraints, and total cost of ownership. By the end, you will know exactly which option fits your project.

Real cost data

Pricing compared at 100K, 500K, and 1M monthly requests with actual provider rates.

Performance tested

Cold starts, TTFB, and P99 latency measured across serverless and VPS.

Migration path

Step-by-step guide to move from serverless to VPS when you outgrow it.

What is serverless?

Serverless computing runs your code in ephemeral containers managed by a cloud provider. You write a function, deploy it, and the provider handles provisioning, scaling, and OS patches. You are billed per invocation and execution duration rather than a monthly fee for a running server.

Popular serverless platforms include AWS Lambda, Google Cloud Functions, Azure Functions, Vercel Functions, and Cloudflare Workers. Each function typically handles a single HTTP request, runs for a limited duration (usually 10-30 seconds max), and is stateless between invocations.

serverless-function.js (AWS Lambda / Vercel)
// A typical serverless function
// Each request spins up a new (or reused) container
export default async function handler(req, res) {
  const { userId } = req.query;

  // Cold start: 200-1500ms if container is not warm
  const user = await db.query("SELECT * FROM users WHERE id = $1", [userId]);

  // Function exits after response — no persistent state
  res.status(200).json({ user });
  // Container may be destroyed after this
}
Serverless advantages
  • - Zero infrastructure management
  • - Auto-scales to any traffic level
  • - Pay only for what you use
  • - No OS updates or security patches
  • - Great for event-driven workloads
Serverless drawbacks
  • - Cold starts add 200-1500ms latency
  • - No persistent connections (WebSockets)
  • - Execution time limits (10-30s)
  • - Stateless: no local file storage
  • - Costs spike with consistent traffic

What is a VPS?

A Virtual Private Server (VPS) is a dedicated virtual machine that runs 24/7 on a physical server. You get allocated CPU cores, RAM, and storage with full root access. Your application process runs continuously, ready to serve requests instantly with no cold starts.

VPS providers include Hetzner (starting at $4.50/mo), DigitalOcean ($6/mo), Vultr ($5/mo), and Linode ($5/mo). You typically get 1-2 vCPUs, 1-2GB RAM, 20-50GB SSD, and 20TB+ monthly bandwidth. That is more than enough to handle hundreds of thousands of requests per month.

server.js (Express on VPS)
// Traditional server — always running, no cold starts
import express from "express";

const app = express();

// Process starts once, stays in memory
app.get("/api/user/:id", async (req, res) => {
  // No cold start — handler executes immediately
  const user = await db.query("SELECT * FROM users WHERE id = $1", [req.params.id]);
  res.json({ user });
});

// Persistent connections work natively
app.ws("/live", (ws) => {
  ws.on("message", (msg) => ws.send(`Echo: ${msg}`));
});

app.listen(3000, () => console.log("Server running on port 3000"));
// Process runs 24/7 — no timeout limits
VPS advantages
  • - Always-on: zero cold starts
  • - Predictable flat monthly cost
  • - Full root access and SSH
  • - Run databases on the same server
  • - WebSockets, cron jobs, background workers
VPS drawbacks
  • - You manage OS updates and security
  • - Manual scaling (upgrade or add servers)
  • - You pay even when idle
  • - Initial setup takes more effort
  • - Need to configure Nginx, SSL, etc.

Cost comparison: serverless vs VPS at scale

This is where the serverless vs VPS debate gets real. Serverless pricing looks cheap at low volumes, but costs grow linearly with traffic. A VPS costs the same whether you serve 1,000 or 1,000,000 requests. Here are real numbers from major providers as of March 2026.

Provider100K req/mo500K req/mo1M req/mo
AWS Lambda$1.80$9.00$18.00
Vercel Functions (Pro)$20.00*$20.00*$35.00+
Cloudflare Workers$0.00$5.00$5.00
Google Cloud Functions$0.80$7.20$15.40
Hetzner VPS (CX22)$4.50$4.50$4.50
DigitalOcean VPS$6.00$6.00$6.00

* Vercel Pro plan is $20/mo base — see our Vercel pricing breakdown for details. Lambda pricing assumes 128MB memory, 200ms avg duration. All prices exclude bandwidth egress and database costs. Cloudflare Workers free tier includes 100K req/day.

The hidden costs of serverless

These numbers only cover compute. Serverless architectures typically require managed databases ($15-50/mo for PlanetScale, Neon, or RDS), managed Redis ($10-30/mo), and object storage for file uploads. On a VPS, you run PostgreSQL, Redis, and store files locally at no additional cost.

Performance comparison: cold starts vs always-on

Performance is where VPS hosting has the clearest advantage. A VPS process is always running, so every request hits a warm server. Serverless functions may need to boot up from scratch on each invocation if the container has gone cold.

MetricServerlessVPS
Cold start latency200-1500ms0ms (always running)
Warm request TTFB50-150ms5-30ms
P99 latency500-3000ms30-100ms
Max execution time10-30 secondsUnlimited
WebSocket supportNo (workarounds exist)Native
Concurrent connections1 per containerThousands
Background jobsNot supportedCron, workers, queues

Cold start latency by runtime

Cold starts vary significantly by language and bundle size. Here are measured cold start times on AWS Lambda with 256MB memory as of early 2026:

Node.js (JavaScript)

200-500ms cold start. The most popular serverless runtime. Smaller bundles (under 5MB) stay near 200ms. Larger Next.js bundles can push 400-600ms.

Python

250-600ms cold start. Similar to Node.js. Import-heavy functions (pandas, numpy) can add 300-500ms due to package loading.

Java / .NET

800-1500ms cold start. JVM and CLR initialization is expensive. Provisioned concurrency ($) can mitigate this, but adds fixed costs.

Rust / Go

Under 100ms cold start. Compiled languages with tiny runtimes. Best serverless performance, but smaller ecosystems for web development.

When to use serverless

Serverless is not universally bad. It excels in specific scenarios where its strengths align with your requirements. Here is when serverless is the right choice:

Event-driven workloads

Processing uploaded files, handling webhooks, sending emails on signup, resizing images. These are infrequent, unpredictable tasks where paying per invocation makes sense. You do not want a server running 24/7 to handle 50 image resizes per day.

Highly variable traffic

If your traffic goes from 0 to 100K requests in minutes (flash sales, viral content, marketing campaigns), serverless scales automatically without capacity planning. A VPS would need a load balancer and multiple servers pre-provisioned.

Quick prototypes and MVPs

When you need to ship fast and do not want to configure servers, Nginx, SSL, or process managers. Vercel and Netlify deploy from a git push. The speed-to-deploy advantage is real during the early validation phase.

Edge computing

Cloudflare Workers and Vercel Edge Functions run at the network edge (300+ locations). For latency-sensitive operations like A/B testing, geolocation redirects, or auth token validation, edge functions deliver sub-10ms response times globally.

When to use a VPS

A VPS is the better choice for the majority of web applications, APIs, and SaaS products. Here is when you should choose a VPS over serverless:

Predictable, steady traffic

If your app serves 10K-1M requests/month with relatively consistent traffic, a VPS is 3-10x cheaper than serverless. You pay the same $5-10/month regardless of request volume, and there are no per-invocation or bandwidth surcharges.

WebSockets and real-time features

Chat apps, live dashboards, collaborative editors, multiplayer games, and notification systems all require persistent connections. A VPS supports WebSockets natively. Serverless functions terminate after each request, making persistent connections impossible without expensive workarounds.

Long-running processes and background jobs

Video processing, PDF generation, data pipelines, scheduled cron jobs, email queue workers. Serverless has a 10-30 second execution limit. A VPS lets you run processes for hours or days. Use PM2 or systemd to manage background workers.

Co-located databases

Running PostgreSQL, MySQL, Redis, or MongoDB on the same server as your application eliminates network latency between your app and database (sub-millisecond queries). With serverless, you need a managed database service, adding $15-50/month and 5-20ms network latency per query.

Full control and compliance

Data residency requirements, custom security configurations, specific OS-level packages, or compliance frameworks (SOC 2, HIPAA) often require infrastructure you fully control. A VPS gives you root access to configure everything exactly as needed.

Multi-app hosting

Run your frontend, API, database, Redis, and background workers on a single $10/month VPS. With serverless, each of these would be a separate billable service. A VPS consolidates your entire stack, reducing both cost and operational complexity.

The same Express app: serverless vs VPS deployment

To make the comparison concrete, here is the same Express API deployed two different ways. The application code is nearly identical, but the deployment model and runtime behavior differ significantly.

1Deployed as a Vercel Serverless Function

api/index.js (Vercel Serverless)
import express from "express";
import { PrismaClient } from "@prisma/client";

const app = express();
app.use(express.json());

// WARNING: New Prisma client on every cold start
// Each cold start opens a new DB connection pool
const prisma = new PrismaClient();

app.get("/api/posts", async (req, res) => {
  const posts = await prisma.post.findMany({
    take: 20,
    orderBy: { createdAt: "desc" },
  });
  res.json(posts);
});

app.post("/api/posts", async (req, res) => {
  const post = await prisma.post.create({ data: req.body });
  res.status(201).json(post);
});

// Vercel wraps this — each request may cold-start
export default app;

// Limitations:
// - 10s execution limit (Pro: 60s)
// - No WebSocket support
// - No cron jobs or background workers
// - New DB connection pool per cold start
// - Max 250MB function bundle size

2Deployed on a VPS with PM2

server.js (VPS with PM2)
import express from "express";
import { PrismaClient } from "@prisma/client";
import { WebSocketServer } from "ws";
import cron from "node-cron";

const app = express();
app.use(express.json());

// Single Prisma client — connection pool stays warm
const prisma = new PrismaClient();

app.get("/api/posts", async (req, res) => {
  const posts = await prisma.post.findMany({
    take: 20,
    orderBy: { createdAt: "desc" },
  });
  res.json(posts);
});

app.post("/api/posts", async (req, res) => {
  const post = await prisma.post.create({ data: req.body });
  // Notify connected WebSocket clients
  wss.clients.forEach((client) => client.send(JSON.stringify(post)));
  res.status(201).json(post);
});

const server = app.listen(3000, () => console.log("Running on port 3000"));

// WebSockets — works natively on VPS
const wss = new WebSocketServer({ server });
wss.on("connection", (ws) => {
  ws.send(JSON.stringify({ type: "connected" }));
});

// Cron jobs — run background tasks on schedule
cron.schedule("0 * * * *", async () => {
  console.log("Hourly cleanup job running...");
  await prisma.session.deleteMany({
    where: { expiresAt: { lt: new Date() } },
  });
});

// No execution time limits
// No cold starts
// Persistent DB connection pool
// Native WebSocket support
// Background jobs with cron
Start with PM2
# Install PM2 globally
npm install -g pm2

# Start the app with auto-restart
pm2 start server.js --name my-api

# Enable startup on reboot
pm2 startup && pm2 save

# View logs
pm2 logs my-api

Migration guide: serverless to VPS

Outgrowing serverless is common. Rising costs, cold start frustrations, or the need for WebSockets and background jobs are the typical triggers. Here is how to migrate your serverless application to a VPS step by step.

1
Consolidate serverless functions into a single Express app

Each serverless function becomes a route handler. If you have /api/users.js, /api/posts.js, and /api/auth.js as separate functions, combine them into one Express app with route files. This typically reduces code duplication and simplifies error handling.

2
Replace managed services with local alternatives

Swap PlanetScale or Neon for PostgreSQL running on your VPS. Replace Upstash Redis with local Redis. Move file uploads from S3 to local disk or keep S3 if you need CDN distribution. This step alone can save $30-80/month in managed service fees.

3
Provision and configure your VPS

Spin up a VPS on Hetzner ($4.50/mo) or DigitalOcean ($6/mo). Install Node.js, PostgreSQL, Redis, Nginx, and Certbot. Follow our PM2 + Nginx production setup guide for a battle-tested configuration.

4
Set up process management and monitoring

Use PM2 to keep your Node.js app running, auto-restart on crashes, and manage log rotation. Add basic monitoring with PM2 Plus (free tier) or set up a simple health check endpoint.

5
Automate deployments with DeployWise

Connect your GitHub repo to DeployWise, add your VPS, and every git push triggers a build and deploy. Zero-downtime deployments, automatic rollback, and deployment logs included. No CI/CD pipeline to maintain.

Nginx reverse proxy config
server {
    listen 80;
    server_name api.yourdomain.com;

    location / {
        proxy_pass http://127.0.0.1:3000;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection "upgrade";
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}

# After running: sudo certbot --nginx -d api.yourdomain.com
# Certbot will auto-add SSL configuration
Typical migration savings

Teams migrating from a serverless stack (Vercel Pro + PlanetScale + Upstash Redis + S3) to a single VPS with DeployWise typically save $50-150/month while gaining better performance, WebSocket support, and simpler debugging. The migration takes 1-2 hours for a standard API.

Architecture comparison at a glance

Here is how a typical SaaS application stack looks when deployed on serverless versus a VPS:

ComponentServerless StackVPS Stack
API serverVercel Functions ($20/mo)Express + PM2 (included)
DatabasePlanetScale ($30/mo)PostgreSQL on VPS (included)
Cache / SessionsUpstash Redis ($10/mo)Redis on VPS (included)
File storageAWS S3 ($5-20/mo)Local disk or S3 ($0-5)
Background jobsAWS SQS + Lambda ($5-15/mo)BullMQ + cron (included)
DeploymentVercel (included in Pro)DeployWise (free)
Total monthly cost$70-115/mo$5-10/mo

VPS pricing based on Hetzner CX22 ($4.50/mo) or DigitalOcean Basic ($6/mo). Serverless pricing based on moderate usage (500K req/mo). All services on the VPS share a single server.

The verdict: which should you choose?

There is no universal answer, but the data points to a clear pattern. Here is a decision framework based on your specific situation:

Choose serverless if...
  • Your traffic is highly unpredictable with massive spikes
  • You are building event-driven microservices (webhooks, queues)
  • You need edge computing for global low-latency
  • You want zero infrastructure management
  • You are prototyping and speed-to-deploy matters most
Choose a VPS if...
  • Your traffic is steady or predictable
  • You need WebSockets, cron jobs, or background workers
  • You want to co-locate your database for free
  • You are cost-conscious and want a flat monthly bill
  • You need long-running processes or file storage
  • You want full control over your infrastructure

For most web applications, APIs, and SaaS products in 2026, a VPS delivers better performance at a fraction of the cost. The main objection to VPS hosting has always been the operational burden of managing servers, deployments, and SSL. Tools like DeployWise eliminate that objection by giving you Vercel-like push-to-deploy on your own VPS, for free.

Frequently asked questions

Is serverless cheaper than a VPS?

It depends on your traffic volume. Serverless is cheaper for very low traffic (under 50K requests/month) because you only pay per invocation. But once you pass 100K-200K monthly requests, a $5-10/month VPS becomes significantly cheaper. At 1M requests/month, serverless can cost $18-50+ while a VPS stays at a fixed $5-10/month.

What are serverless cold starts and how bad are they?

Cold starts happen when a serverless function has not been invoked recently and the cloud provider needs to spin up a new execution environment. Cold starts typically add 200-1500ms of latency depending on the runtime and bundle size. Node.js functions average 200-500ms, while Java or .NET can exceed 1000ms. VPS servers have no cold starts since the process is always running.

Can I run a database on serverless?

Not directly. Serverless functions are stateless and ephemeral, so you cannot run a traditional database like PostgreSQL or MySQL on them. You need a managed database service (RDS, PlanetScale, Neon) which adds cost. On a VPS, you can run your database on the same server as your application at no extra cost.

Is serverless better for scaling?

Serverless scales automatically to handle traffic spikes without configuration, which is a significant advantage for unpredictable workloads. However, this auto-scaling can also lead to surprise bills. A VPS requires manual scaling (upgrading the server or adding load balancers), but you always know your maximum cost. For most apps under 1M monthly visitors, a single VPS handles the load fine.

Can I use WebSockets with serverless?

Standard serverless functions (AWS Lambda, Vercel Functions) do not support persistent WebSocket connections because they are designed for short-lived request-response cycles. AWS offers API Gateway WebSocket APIs as a workaround, but it adds complexity and cost. VPS servers support WebSockets natively since the server process runs continuously.

How do I migrate from serverless to a VPS?

Extract your serverless functions into a standard Express or Fastify app, set up a VPS with Node.js and a process manager like PM2, configure Nginx as a reverse proxy, and deploy. Tools like DeployWise automate this entire process: connect your GitHub repo, add your VPS, and push to deploy. The migration typically takes 1-2 hours.

What is the best option for a startup or side project?

For a side project or early-stage startup, a VPS with DeployWise gives you the best combination of low cost, full control, and simple deployment. You pay $5-10/month flat with no surprise bills, get full SSH access, and can run your app, database, and background jobs on a single server. Serverless makes sense if your traffic is highly unpredictable or you need to prototype quickly without managing infrastructure.

Deploy to your VPS like it's Vercel

Done paying serverless bills? DeployWise gives you push-to-deploy on your own VPS. Connect your GitHub repo, add your server, and ship. Free and open source.

Try DeployWise Free

Related guides and articles