Serverless Architecture: 8 Tradeoffs to Review Before You Build
Serverless architecture lets a team build and run software without directly managing the underlying servers. A cloud provider or platform handles much of the provisioning and scaling, while developers focus on functions, APIs, events, and business logic. The servers still exist; “serverless” describes who manages them.
Serverless computing can reduce infrastructure work for event-driven or variable workloads. It also changes how teams handle execution limits, state, observability, cost, and vendor dependencies. This article explains the main patterns, tradeoffs, and design checks to review before choosing a serverless architecture.
How serverless architecture works
A serverless application often combines managed services and small compute units. A user request may pass through an API gateway to a function, which reads from a database or sends a message to a queue. An event such as a file upload can trigger a background process without a server running full time for that task.
Functions are typically short-lived and scale in response to events or requests. Managed databases, authentication, object storage, messaging, and workflow services may provide the rest of the application. Some platforms also offer serverless containers, which run a complete container while abstracting more of the server management.
AWS describes Lambda as a serverless compute service that runs code without the user provisioning servers. Microsoft’s guidance for Azure Functions considers how to design function-based workloads within the Azure Well-Architected Framework. These examples show that serverless describes an operating model, while implementations differ by provider.
When serverless can be a good fit
- Event-driven work: process uploads, notifications, messages, or scheduled tasks when they occur.
- Variable demand: handle workloads that rise and fall without reserving capacity for every peak.
- Small independent services: isolate a bounded task with clear inputs and outputs.
- Early product validation: reduce initial infrastructure operations while a team tests an idea.
- Managed integration: connect APIs, storage, queues, and business processes using provider services.
Serverless may be a poor fit when a workload needs long-running processes, low and highly predictable latency, specialized hardware, extensive runtime control, or a strong portability requirement. It can still work, but the team should test those constraints before committing.
Eight tradeoffs to review before you build
1. Workload shape and execution limits
Understand how long a task runs, how much memory it needs, how often it runs, and how bursty its traffic becomes. Function platforms set limits for timeouts, payload size, concurrency, and runtime. A process that exceeds a function limit may need to break into smaller steps or run in a container or job service.
Do not split code into many functions just to make it “cloud native.” Each boundary adds network calls, permissions, retries, and monitoring. Keep a task together when it shares a transaction or needs tight coordination.
2. Cold starts and response time
A function that has not run recently may need time to initialize. Cold starts matter most when users expect interactive response and the function has a heavy runtime or many dependencies. Measure the actual path with the expected runtime and deployment setup.
Teams can reduce initialization work, reuse safe connections, or configure capacity options where available. These techniques can add cost or complexity, so compare them with the experience users need. For a batch task, a short startup delay may have no practical impact.
3. State, retries, and idempotency
Function instances may start and stop at any time. Keep durable state in a database, object store, or workflow service rather than relying on local memory. A function should handle repeat delivery safely because many event systems can retry when they do not receive a successful acknowledgement.
For operations such as payment capture or account creation, make a repeated event produce one intended result. Use idempotency keys, conditional writes, or another explicit deduplication approach. Decide how to handle poison messages that continue to fail.
4. Service boundaries and orchestration
When a business process spans multiple functions, draw the sequence and failure paths. A workflow orchestration service can make waits, retries, branching, and compensation visible. For a simple request path, however, a workflow engine may be unnecessary.
Monitor the full journey, not only each function. An API can succeed while a downstream event remains stuck in a queue. Map how services interact and define which system owns each state transition.
5. Security and permissions
Assign each function the smallest set of permissions it needs. Separate roles by workload and environment; avoid one broad credential shared by every function. Protect secrets in a managed store, validate inputs, and restrict network paths to necessary dependencies.
Review event sources as part of the threat model. A public endpoint, a queue, and an internal scheduled task have different trust boundaries. Make authentication, authorization, input limits, and audit logging explicit.
6. Observability and local testing
Distributed serverless systems can make it harder to follow a request across services. Use structured logs, traces, correlation identifiers, and meaningful metrics. Track failures, duration, queue age, throttling, and dependency errors. Mask personal or secret data in logs.
Local emulators can speed development, but they do not reproduce every cloud behavior. Test critical paths in an isolated environment that uses the actual provider services or faithful test substitutes. Include failure scenarios, not only the happy path.
7. Cost behavior and guardrails
Usage-based pricing can work well when workloads are intermittent, but costs can grow with invocation volume, execution time, data transfer, logging, and managed services. Estimate the whole workflow, not only function runtime. Set budgets or alerts and test how the service behaves during unexpected traffic.
Retries can amplify cost if a dependency keeps failing. Put limits and dead-letter handling in place, and alert on unusual invocation patterns. AWS’s Lambda best practices include guidance on idempotency, resource reuse, concurrency, and monitoring. Apply equivalent practices to other platforms.
8. Portability and operational ownership
Provider-specific event formats and managed services can speed delivery, yet they may make migration harder. Decide whether portability is a business requirement or a theoretical preference. If the company needs an exit path, document service dependencies and keep business rules separate from provider-specific adapters where practical.
Assign ownership for deployment, access, monitoring, incident response, and cost review. Serverless removes some server maintenance but not operational responsibility. Teams still need to manage code, permissions, data, service configuration, and reliability.
Serverless versus containers
Serverless functions abstract infrastructure and commonly run in response to events or requests. Containers package an application runtime and give teams more control over processes and dependencies. Managed container services can still abstract server administration, while giving an application a longer-running model.
Choose based on the workload and how the team wants to operate it. A business application can combine approaches: functions for scheduled work, a containerized API for long-lived connections, and managed databases for state. Keep the architecture as simple as its users and operations allow.
How to start safely
Pick one bounded workflow with an observable outcome. Document triggers, data, permissions, expected volume, timeout, retries, and failure behavior. Build a proof of concept that includes monitoring and cost estimates, then load test it against realistic traffic.
Before production, define rollback, replay, and incident procedures. Review access with security owners, and test how the workflow handles duplicate events and unavailable dependencies. Expand only after the team can operate the first workload reliably.
For applications with several independently owned components, Oxen’s article on service mesh architecture discusses networking and observability concerns that may arise as systems distribute. If the product is a multi-tenant SaaS platform, see multi-tenant SaaS architecture for another set of boundaries to plan.
Frequently Asked Questions
What is serverless architecture?
It is an approach where a provider manages much of the server infrastructure and the application uses managed services, functions, or serverless containers to run workloads.
Does serverless mean there are no servers?
No. Servers still run the software. The provider handles more of their provisioning and maintenance, so the application team does not manage them directly.
Is serverless cheaper than traditional hosting?
It depends on usage patterns, execution time, data movement, and managed services. Estimate the whole workload and monitor costs after launch.
Can a serverless application use a database?
Yes. Applications commonly use managed relational or NoSQL databases. Design connection reuse, concurrency limits, transaction needs, and durable state deliberately.
Serverless architecture can reduce infrastructure management for workloads that fit its execution model. Test latency, retries, security, cost, and operations with a real use case before committing. When you need help connecting managed cloud services to a reliable business application, talk with Oxen Softwares.
Build software around how your business works
Plan an application architecture that matches your workload, users, and operations team.