Serverless computing runs code in response to events without provisioning or managing servers. You write a function, the provider handles everything else — scaling, availability, and execution infrastructure.
How Serverless Works
Functions are stateless, short-lived execution units. They start when triggered (HTTP request, queue message, scheduled event, storage change) and stop when done. Billing is per invocation and per millisecond of execution time.
AWS Lambda
The original and most widely used serverless platform:
- Runtimes: Node.js, Python, Java, Go, .NET, Ruby, custom runtimes
- Concurrency: Up to 10,000 concurrent executions per region by default
- Duration: Up to 15 minutes per invocation
- Cold starts: 100ms–1s depending on runtime and memory allocation
- Pricing: .20 per 1M requests + .0000166667 per GB-second
- Triggers: API Gateway, SQS, SNS, S3, DynamoDB, EventBridge, and more
Azure Functions
- Runtimes: C#, JavaScript, Python, Java, PowerShell, custom
- Hosting plans: Consumption (serverless), Premium (pre-warmed), Dedicated (app service)
- Durable Functions — stateful workflows using the orchestrator pattern
- Premium plan eliminates cold starts with pre-warmed instances
- Deep integration with Azure Event Grid, Service Bus, Cosmos DB
Google Cloud Functions / Cloud Run
- Cloud Functions (Gen 2) — event-driven, built on Cloud Run
- Cloud Run — containers on demand; more flexibility than function-level abstraction
- Runtimes: Node.js, Python, Go, Java, .NET, Ruby, PHP
- Scale to zero, scale to thousands of instances
- Concurrency: Cloud Run supports multiple requests per container instance (unlike Lambda’s one-per-container model), which reduces cold starts significantly
Cold Start Comparison
Cold starts occur when a new instance is initialized. Factors: runtime (JVM is slow, Node.js/Python are fast), memory allocation, and package size.
| Provider | Typical cold start | Mitigation |
|---|---|---|
| Lambda | 100ms–1s | Provisioned concurrency |
| Azure Functions | 1–3s | Premium plan |
| Cloud Run | 50ms–2s | Min instances setting |
When to Use Serverless
Serverless is well-suited for: event-driven processing, webhooks and APIs with variable traffic, scheduled tasks, and data transformation pipelines. It’s less suited for: long-running processes, latency-sensitive applications where cold starts matter, and workloads requiring persistent connections.