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

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

When serverless with AWS Lambda and similar saves cost and effort, where cold starts, time limits and lock-in cause trouble, and what the alternatives are.

In short: Serverless architecture pays off for applications with irregular or spiky load, for event-driven tasks like webhooks and file processing, and for teams that do not want to look after servers. With steady high load, long-running processes or strict latency requirements, a classic server or container is often cheaper and simpler. Many systems work best with a mix of both.

What serverless means

There are still servers, of course. The term means you do not manage them: no operating system to patch, no capacity to plan, no machines to spin up. You write functions, deploy them to a provider such as AWS Lambda, Google Cloud Run functions or Azure Functions, and the provider runs them on demand.

You pay for actual usage, meaning the number of invocations and compute time. When nothing runs, it costs almost nothing. When load suddenly rises, the provider starts more instances automatically. The serverless world also includes managed services such as databases, queues and file storage that likewise need no servers of your own.

When serverless makes sense

Spiky or unpredictable load

An application that sees little traffic most of the day and a lot at specific moments, such as promotions, registration deadlines or seasonal peaks, benefits from automatic scaling. You do not pay for capacity that sits idle most of the time.

Event-driven tasks

Processing webhooks, resizing uploaded images, generating PDFs, sending a report overnight: these tasks are triggered by an event, run briefly and are done. That is exactly what serverless was built for.

Small teams and early product stages

If you are building an MVP or working without a dedicated DevOps team, serverless saves operational effort. The team can focus on features instead of server maintenance.

When serverless becomes a problem

Cold starts

If a function has not been called for a while, the provider has to start a fresh environment on the next call. This delay, the cold start, does not matter for background jobs but is noticeable in an interactive API. There are countermeasures such as provisioned instances, but those bring back fixed running costs.

Long runtimes and persistent connections

Functions have time limits, a maximum of 15 minutes on AWS Lambda. Long data processing, video encoding or permanently open WebSocket connections fit this model poorly. Database connections are another issue: many parallel function instances can overwhelm a classic relational database with connections unless a connection pooler sits in front of it.

Steady high load

For an application with even, round-the-clock utilisation, per-invocation billing quickly gets more expensive than a fixed server or container. A cost comparison based on your real traffic is worth doing. Our post on cost optimisation in the cloud describes further approaches.

Vendor lock-in

Serverless applications often rely on tightly coupled services from one provider: functions, queues, authentication, database. Moving later means a lot of rework. A clean separation between business logic and provider-specific code keeps that dependency smaller.

Operations, debugging and data protection

Distributed functions are harder to oversee than a single application. An error can travel through several functions and queues before it shows up. Structured logs, tracing across service boundaries and alerts are needed from day one. Our article on monitoring and observability shows what that looks like.

On data protection: the large providers run data centres in the EU, AWS for example in Frankfurt. Choose the region deliberately, sign a data processing agreement and check which additional services process data outside that region.

The hybrid as the normal case

In practice the question is rarely serverless or not. A typical architecture runs the main application in a container or on a server and moves background tasks, webhooks and scheduled jobs into functions. Platforms like Vercel or Netlify combine both by serving frontends and running server-side logic as functions or at the network edge. Our post on edge computing explains how edge functions differ. And if you need to settle the broader question of how to structure your application, our comparison of microservices and monoliths can help.

Frequently asked questions (FAQ)

Is serverless always cheaper than running my own server?

No. With low or very spiky load serverless is usually cheaper, and with steady high load it is often more expensive. Compare costs using your actual invocation counts and runtimes.

Can I move an existing application to serverless?

Partly. Individual tasks like file processing or webhooks are easy to extract. A full migration usually requires a larger rebuild, because state, database access and long processes have to be handled differently.

How do I deal with cold starts?

Keep functions small with few dependencies so they start quickly. For latency-critical endpoints, providers offer provisioned instances. If an API needs consistently fast responses, a container is often the simpler answer.

Can serverless be used in a GDPR-compliant way?

Yes, if you choose an EU region, sign a data processing agreement and make sure logs and additional services stay in the EU as well. Responsibility for the configuration lies with you.

Conclusion

Serverless plays to its strengths with short, event-driven tasks and fluctuating load. Run the main application where it is cheapest and most predictable, add functions where they fit, and you get the benefits without the usual drawbacks.

If you want to work out the right architecture for your application, talk to us about web development.