FaaS Use Cases and Anti-Patterns
What You'll Learn
You'll discover when FaaS shines brightest and when it becomes the wrong tool for the job.
Ideal FaaS Use Cases
Event-driven, sporadic workloads are FaaS's sweet spot. Think of functions like motion-sensor lights—they only activate when triggered, making them perfect for:
- API backends with variable traffic: Handle webhook endpoints or REST APIs where traffic is unpredictable
- Data processing pipelines: Transform uploaded files, process streaming data, or resize images on demand
- Scheduled tasks: Run nightly reports, cleanup jobs, or periodic backups without maintaining always-on servers
- IoT and mobile backends: Respond to device events or push notifications
- Integration glue: Connect services together (e.g., when a database row changes, update a cache)
These scenarios leverage FaaS's pay-per-execution model and automatic scaling—you're not paying for idle time between events.
FaaS Anti-Patterns
Certain workloads fight against FaaS's stateless, short-lived nature:
- Long-running processes: Jobs exceeding function timeout limits (remember those 15-minute constraints?) need traditional compute
- High-frequency, predictable loads: If your function runs constantly 24/7, you're paying premium prices for convenience—dedicated servers become cheaper
- Stateful applications: Databases, session management, or WebSocket connections conflict with stateless function design
- Low-latency requirements: Cold starts introduce unpredictable latency that real-time applications can't tolerate
- Large dependency packages: Deployment package limits make functions with massive libraries impractical
Think of FaaS like a taxi service: brilliant for occasional trips, wasteful if you need a car all day every day.
Key Takeaway: Use FaaS for intermittent, event-driven workloads where you value simplicity and automatic scaling over cost optimization for sustained loads. Avoid it when you need persistent connections, ultra-low latency, or continuous execution.