We are re-platforming our e-commerce site and debating between AWS Lambda (Serverless) and Amazon EKS (Kubernetes). Our traffic is very spiky, especially during flash sales. While serverless seems easier to scale, I’m worried about "cold starts" and long-term costs. Which architecture offers the best balance of performance and scalability for a growing retail brand?
3 answers
The choice depends on your execution duration and frequency. Serverless is unbeatable for event-driven tasks and highly unpredictable traffic because you only pay for the exact milliseconds used. To mitigate cold starts, use "Provisioned Concurrency," though that adds cost. However, for a consistent e-commerce baseline, Containers (K8s) are often more cost-effective. You can use Horizontal Pod Autoscaling (HPA) to handle the spikes while maintaining warm instances for your core checkout flow. If your application has long-running processes (over 15 minutes), Lambda isn't even an option due to its timeout limits. I’d suggest a hybrid approach: K8s for the core API and Lambda for image processing or email triggers.
Have you benchmarked the Latency difference between a warm container and a cold Lambda function for your specific user-facing API calls?
I prefer Serverless because it removes the "Ops" from DevOps. My team focuses on code, not patching worker nodes or managing Kubernetes clusters.
Susan makes a great point. The "Total Cost of Ownership" includes developer hours. Serverless often wins when you factor in the salary of a K8s expert.
Christopher, that latency is the silent killer of conversion rates! Amanda, for e-commerce, every 100ms of delay can cost 1% in sales. If you go serverless, keep your functions small and use a language like Go or Node.js, which have much faster start times than Java. Also, consider a Content Delivery Network (CDN) like CloudFront to cache as much as possible at the edge. This reduces the number of times your backend (serverless or container) even needs to be hit, which solves both the cost and the speed problem simultaneously.