Serverless (FaaS – Function as a Service) là mô hình cloud computing nơi developer chỉ viết code (functions), không quản lý server infrastructure; provider tự động provision, scale, và bill theo actual invocations (pay-per-use). AWS Lambda, Google Cloud Functions, Vercel Functions là các giải pháp phổ biến.
Ưu điểm: zero infrastructure management, auto-scaling từ 0 đến hàng nghìn instances ngay lập tức, cost-effective cho sporadic/unpredictable traffic (không trả tiền khi idle), giảm operational overhead.
Nhược điểm: Cold Start latency — Node/Python thường < 100ms P50 nhờ AWS Lambda Provisioned Concurrency và SnapStart (GA 2023 cho Java), nhưng vẫn là vấn đề nếu không dùng tính năng này; execution time limit (Lambda tối đa 15 phút); vendor lock-in; stateless (mỗi invocation độc lập, phải dùng external store); không phù hợp cho long-running processes.
Phù hợp cho: webhooks, scheduled jobs (cron), event-driven processing (S3 trigger, SQS), APIs với variable traffic. Không phù hợp cho: latency-sensitive real-time APIs cần cold start <10ms, stateful applications.
Serverless (FaaS — Function as a Service) is a cloud computing model where developers write only code (functions) and do not manage server infrastructure; the provider automatically provisions, scales, and bills based on actual invocations (pay-per-use). AWS Lambda, Google Cloud Functions, and Vercel Functions are popular solutions.
Pros: zero infrastructure management, instant auto-scaling from zero to thousands of instances, cost-effective for sporadic or unpredictable traffic (no cost when idle), reduced operational overhead.
Cons: Cold start latency — Node/Python typically achieve < 100ms P50 with Provisioned Concurrency; AWS Lambda SnapStart (GA 2023 for Java) reduces Java cold starts significantly. Cold starts remain a concern only when these features are not used. Execution time limits (Lambda max 15 minutes); vendor lock-in; stateless (requires external state store); not suitable for long-running processes.
Best suited for: webhooks, scheduled jobs (cron), event-driven processing (S3 triggers, SQS), APIs with variable traffic. Not suited for: latency-sensitive APIs requiring < 10ms cold start, stateful applications.