Serverless computing lets developers ship code without provisioning or managing servers. The platform handles scaling, availability and billing, charging only for actual usage. This article explores where serverless shines and where it struggles.
Core Concepts
1. Function as a Service (FaaS)
Functions run in response to events — HTTP requests, queue messages, file uploads, database changes. The platform spins up instances on demand and scales them automatically, freeing teams from capacity planning.
2. Managed Services
Beyond functions, serverless includes managed databases, messaging, object storage and authentication. Composing managed services reduces operational burden dramatically.
3. HTTP and Routing
API gateways route requests to functions, providing auth, rate limiting, validation and observability. Functions stay small and single-purpose.
When Serverless Excels
- Spiky or unpredictable traffic that would waste idle compute
- Event-driven workloads and integrations
- Short-lived, stateless request handlers
- Startups and small teams without dedicated ops
- Greenfield services where vendor lock-in is acceptable
Key Trade-offs
1. Cold Starts
Infrequently invoked functions suffer latency while the runtime initialises. Choose lightweight runtimes, minimise dependencies, and size functions appropriately to reduce cold-start impact.
2. Cost Model
You pay per invocation and per duration. While cheap at moderate load, sustained high usage can make serverless more expensive than provisioned instances. Model cost carefully.
3. Execution Limits
Functions have bounded memory, compute time and concurrency. Long-running or compute-heavy workloads may not fit. Keep functions fast and delegate heavy work to managed services.
4. State and Connections
Functions are stateless and ephemeral. Maintain external state in managed databases or caches and reuse connections across warm invocations to avoid reconnecting constantly.
5. Observability and Debugging
The distributed, ephemeral nature of functions makes tracing and logging essential. Instrument with distributed tracing and centralised logs from the start.
Design Recommendations
- Keep functions small and single-responsibility
- Use event-driven triggers and managed services where possible
- Set sensible timeout, memory and concurrency limits
- Implement idempotency for retried events
- Test locally and deploy with infrastructure-as-code
- Monitor invocation errors, p99 latency and cold-start rates
Serverless is a powerful tool in the platform toolkit, but it is not a universal answer. Match the architecture to the workload, and combine managed services with clearly owned components for the best balance of cost, performance and operability.
Codingfigs designs and operates serverless platforms for clients who value speed and simplicity. Contact our platform engineering team.