4 ms·
There is nothing wrong with using lambda to synchronously respond to user facing API requests. It actually works really well and I would highly recommend it. We
by southpolesteve 10y ago
There is nothing wrong with using lambda to synchronously respond to user facing API requests. It actually works really well and I would highly recommend it. Were doing it in production at ~15 million calls/day.
- Touche 10y agoIsn't it expensive though?
- southpolesteve 10y agoThat is the best part! It is cheaper! We had a node service that went from $2500/mo to $400/mo just by switching form Ec2 to Lambda. That is the most apples to apples comparison I can give you. Other services were split up or rewritten, but honestly my gut feeling tells me they are costing 10x-50x less. IMO Autoscaling ec2 instances to daily traffic is not a trivial problem and you'll never get the granularity you can with Lambda
- leoalves 10y agoYou are also saving in not having someone maintaining and making sure the server is always online. Even if it was the same price, not having to worry about the server is a big plus
- skrowl 10y agoCheaper than standing up enough EC2 instances to do the same volume. That's the idea at least.
- zbjornson 10y agoStrictly looking at server uptime, yes, it's nearly 5x the cost of comparable t2 on-demand EC2 instances. That can be mitigated if you have spiky traffic where you'd need to turn on several EC2 instances for less than an hour but are stuck paying for the full hour, or if you can scale to zero for extended periods of time. You don't have the ability to serve concurrent requests from a single lambda worker, so if you're waiting for async IO then you're wasting money you wouldn't be wasting with EC2. -- For us lambda was prohibitively expensive at scale. I suspect a fair number of people reporting significant savings vs EC2 had over-provisioned instances.