Logo

Insight

Serverless Architecture: When It Makes Sense and When It Doesn't

Serverless promises to remove infrastructure management entirely, but it isn't the right fit for every workload. Here's a clear-eyed look at when serverless architecture pays off and when it creates new problems.

Novilance Team headshot

Novilance Team

Cloud Architecture Team

Jul 1, 202611 min read
Serverless Architecture: When It Makes Sense and When It Doesn't

Serverless architecture gets pitched as a universal upgrade: no servers to patch, automatic scaling, pay only for what you use. For a specific class of workloads that's true. For others, serverless quietly introduces cold starts, unpredictable costs at scale, and debugging headaches that a well-run container setup wouldn't have. The decision isn't philosophical — it comes down to your traffic pattern, latency requirements, and how long your functions actually run.

This guide explains how serverless architecture actually works, where it delivers real value, where it breaks down, and how to decide between serverless, containers, and traditional servers for your next system.

What Is Serverless Architecture?

Serverless architecture runs application code in stateless, ephemeral compute units (functions) that a cloud provider allocates on demand, in response to an event — an HTTP request, a queue message, a file upload, a scheduled trigger. There is still a server involved; you simply don't provision, patch, or scale it yourself. The provider handles that, and bills you based on execution time and invocation count rather than a fixed instance running 24/7.

How Serverless Works

When an event arrives, the platform (AWS Lambda, Google Cloud Functions, Azure Functions, or a framework like Vercel Functions/Cloudflare Workers) spins up an execution environment, runs your function, returns the result, and eventually tears the environment down after a period of inactivity. If the function hasn't run recently, the platform has to initialize a fresh environment before executing — this is a cold start, and it's the single biggest source of latency complaints about serverless systems.

Because each invocation is stateless, any data that needs to persist between calls has to live outside the function — in a database, cache, or object store. This is a deliberate constraint that forces good architecture (no in-memory state to leak or corrupt) but also means serverless functions are not a drop-in replacement for a long-running server process that keeps state in memory, like a WebSocket server or an in-memory cache.

Serverless vs Containers vs Traditional Servers

FactorTraditional ServersContainers (e.g. Kubernetes)Serverless
ScalingManual or basic autoscaling groupsAutomatic, configurable, but you manage the clusterAutomatic, fully managed by provider
Cost modelPay for uptime regardless of usagePay for cluster capacityPay per invocation/execution time
Cold startsNoneRare, only on scale-upCommon on infrequently-used functions
Operational overheadHigh — patching, scaling, monitoringMedium-high — cluster and deployment managementLow — provider manages the runtime
Best forPredictable, steady, high-throughput workloadsComplex, stateful, multi-service systemsSpiky, event-driven, infrequent workloads
Max execution timeUnlimitedUnlimitedLimited (e.g. 15 min on AWS Lambda)

Tip

If your workload runs constantly at high, steady volume, serverless per-invocation pricing often ends up more expensive than a reserved container or instance running the same load 24/7. Serverless wins on spiky, unpredictable, or infrequent traffic — not on steady-state throughput.

Benefits of Serverless Architecture

  • No server provisioning, patching, or capacity planning — the provider manages the runtime entirely
  • Automatic scaling to zero and back up, so you don't pay for idle capacity
  • Faster time to production for event-driven workloads like webhooks, scheduled jobs, and API endpoints with irregular traffic
  • Built-in high availability across zones without extra configuration in most managed platforms
  • Smaller blast radius for deployments — you can update individual functions independently

Where Serverless Falls Short

  • Cold starts add latency (often 100ms-2s depending on runtime and package size) that's unacceptable for latency-sensitive APIs
  • Long-running processes (video processing, large batch jobs) hit execution time limits and need workarounds or a different compute model
  • Costs can become unpredictable and higher than containers at sustained high volume
  • Debugging distributed, function-based systems is harder than debugging a monolith or a small set of services with full local reproducibility
  • Vendor lock-in tends to be deeper than with containers, since serverless platforms have provider-specific event formats and integrations

Use Cases Where Serverless Wins

Serverless is a strong fit for webhook handlers (Stripe events, GitHub events, form submissions), scheduled jobs (nightly reports, cleanup tasks), image and file processing triggered by uploads, lightweight APIs with unpredictable or low traffic, and glue code that connects SaaS tools together. It's also a good default for early-stage products where traffic is unpredictable and minimizing operational overhead matters more than shaving milliseconds of latency.

Use Cases Where Serverless Struggles

Avoid serverless for latency-critical APIs serving consistent high traffic (the cold start tax and per-invocation cost add up), long-running batch or video processing jobs that exceed execution time limits, systems that need persistent in-memory state or WebSocket connections, and workloads with steady, predictable, high-volume traffic where a reserved container setup is cheaper.

Step-by-Step: Deciding and Migrating

  • Chart your traffic pattern over a representative period — steady and high favors containers, spiky and low-to-medium favors serverless
  • Identify any workloads with execution times near or above your platform's limit and rule those out for serverless
  • Estimate cost at your actual (not average) peak volume using the provider's calculator — don't extrapolate from a demo's low-traffic pricing
  • Start with the lowest-risk, most event-driven part of your system (webhooks, scheduled jobs) as a pilot
  • Measure cold start impact under real conditions before committing latency-sensitive endpoints to serverless
  • Keep stateful, long-running, or latency-critical services on containers or traditional servers, and use serverless for the event-driven edges around them
// Example: AWS Lambda function handling a Stripe webhook
export const handler = async (event) => {
  const stripeEvent = JSON.parse(event.body);

  if (stripeEvent.type === "invoice.payment_failed") {
    await notifyBillingTeam(stripeEvent.data.object);
  }

  return { statusCode: 200, body: JSON.stringify({ received: true }) };
};

Common Mistakes

  • Migrating an entire monolith to serverless functions at once instead of starting with event-driven edges
  • Not accounting for cold starts when the workload has strict latency SLAs
  • Assuming serverless is always cheaper — at sustained high volume it frequently isn't
  • Trying to maintain in-memory state across invocations, which breaks under real concurrency
  • Ignoring execution time limits until a batch job starts failing intermittently in production

Best Practices Checklist

  • Map traffic patterns before choosing serverless, containers, or traditional servers — don't default to serverless because it's trendy
  • Pilot with event-driven, non-latency-critical workloads first
  • Set concurrency limits to control cost and downstream load on databases
  • Externalize all state to a database, cache, or object store — never assume in-memory persistence between invocations
  • Monitor cold start rates and invocation costs monthly, not just at launch
  • Keep a clear boundary: serverless for spiky event-driven work, containers or servers for steady-state and stateful services

Case Study

An E-Commerce Platform Cuts Infrastructure Costs 40% by Moving Only Its Event-Driven Workloads to Serverless

An online retailer was running its entire backend, including webhook processing, image resizing, and nightly reporting jobs, on a fixed set of always-on EC2 instances sized for Black Friday traffic year-round. We moved the spiky, event-driven pieces — Stripe and shipping-provider webhooks, product image processing on upload, and scheduled reports — to AWS Lambda, while keeping the core order-processing API and database on right-sized containers since that traffic was steady and latency-sensitive. Infrastructure costs dropped 40% because the retailer stopped paying for idle webhook and image-processing capacity 350 days a year, while the latency-sensitive checkout API saw no change in response time since it stayed off serverless entirely.

Serverless Architecture by the Numbers

100-500ms

Typical cold start latency (Node.js, small package)

30-40%

Typical infra cost reduction for spiky workloads

15 minutes

Common execution time limit (AWS Lambda)

Majority

Share of production serverless use that's event-driven, not full backends

Serverless isn't a replacement for good architecture — it's another compute option with a specific shape of tradeoffs. The teams that get burned are the ones who picked it for every workload instead of the ones it actually fits.

Novilance Cloud Architecture Team

Frequently Asked Questions

Is serverless cheaper than containers?

It depends on traffic pattern. For spiky or low-volume workloads, serverless is usually cheaper because you don't pay for idle capacity. For steady, high-volume traffic, a right-sized container or reserved instance is often cheaper per request.

What causes serverless cold starts and can they be avoided?

Cold starts happen when the platform needs to initialize a new execution environment for a function that hasn't run recently. They can be reduced with smaller deployment packages, lighter runtimes, and provisioned concurrency (keeping a set number of environments warm), though provisioned concurrency reintroduces some of the always-on cost serverless is meant to avoid.

Can you run a full backend on serverless?

Yes, and some companies do, but it usually makes more sense to run the event-driven, spiky parts of a system on serverless while keeping steady-state, latency-critical, or stateful services on containers or traditional servers.

Does serverless lock you into one cloud provider?

More than containers do. Serverless platforms use provider-specific event formats, IAM models, and integrations, so migrating between AWS Lambda, Google Cloud Functions, and Azure Functions typically requires real rework, not just a config change.

Is serverless a good fit for an early-stage startup?

Often yes, specifically because traffic is unpredictable and minimizing operational overhead matters more early on than shaving latency. It's a reasonable default until traffic patterns stabilize enough to justify a different setup.

Conclusion

Serverless architecture is a strong fit for event-driven, spiky, infrequent workloads and a poor fit for steady-state, latency-critical, or long-running processes. The mistake most teams make isn't choosing serverless — it's choosing it for everything instead of mapping their actual traffic and latency requirements first. The right answer for most production systems is a mix: serverless at the event-driven edges, containers or traditional servers for the core.

If you're deciding between serverless, containers, and traditional infrastructure for a new system, Novilance can help you map the tradeoffs against your actual traffic patterns before you commit. See also: Cloud Migration Strategy Guide, Cloud DevOps for Early-Stage Startups, and Kubernetes for Small Teams.

Work with us

Ready to bring your next flagship product to market?

Book a Call

Related Services

Get In Touch

Let's create something amazing together

Contact us

Schedule a Call

Prefer to chat directly? Book a 30-minute consultation with our team.

Schedule on Calendly

Connect