Hacker News new | past | comments | ask | show | jobs | submit login

I find it to be an antipattern.

Lambda excels at taking in arbitrary amounts of long-running jobs and feeding you its output. For example: Upload a png image to convert it to jpg. Zip a directory of S3 objects. Etc.

Lambda gets very costly and inconvenient when you're just taking in requests you could handle by a couple of load-balanced web servers. The whole "running a whole website on Lambda" craze does not actually yield any benefit and is more complex, harder to play with than a simple ec2 instance (which, with a good setup, needs very little "server" management at all).

Also, API Gateway is just horribly inflexible imho.




I've heard API Gateway is painful to configure but that frameworks like serverless.com help a lot.

But I'm surprised to hear that Lambda gets costly. Is this from real experience or is it just theoretical? My impression was that Lambda saves you money by not having to pay for excess capacity. But I haven't done the math. I'll admit, it's also appealing to not even have to worry about configuring a web server cluster to scale up and down.


Lambda costs are two-fold: You have a set cost per API request as well as a cost per 100ms chunks of work.

On top of this, you can't increase one of CPU or Memory allocation without increasing the other. This means if you're very memory-efficient and CPU-bound, you'll be eating extra runtime costs. You also kind of end up using the entire Amazon toolchain, which has costs embedded in every single bit of it. SNS, SQS, API Gateway, S3 requests, S3 network out, etc they all have costs.

And here's the thing: Lambda has a ton of layering on top of it, which you wouldn't have in an EC2 environment where you have full control. You can't optimize Lambda, you can optimize EC2.

My company is currently paying $4k/mo in Lambda costs, parsing log files in Python into XML and doing an S3 call at a peak of 40 requests / second. Back of the envelope, we can probably get this down to <$300/mo by overprovisioning a few m4.large instances. But now there's the question of having to manage a processing queue, reprocessing, etc so it's hard to tell how much would actually be saved. (On top of that, if a box goes down, that's a significant chunk of processing unable to be taken care of; with Lambda, that doesn't happen).

All in all, has been excellent to us to get started, but there's a point where we definitely want to investigate a dedicated system we have full control of. Lack of Python 3 support was the #1 reason I wanted to do that, so now there's a bit less motivation - it's a lot of work.

I'll certainly write a blog post about it if we decide to move our main processing off Lambda.

Edit: This looks like it has a lot of interesting numbers. https://www.reddit.com/r/Python/comments/4hebys/cost_analysi...


What sort of logs and processing are you doing? Do you mean 40 log entries per second, or 40 calls against your log processing service/infrastructure?


~40 500kb logs per second. The logs are Hearthstone games.


API Gateway needs less config since they released the proxy style integration. In Lambda's case this means you can just return a JSON object like:

{ "statusCode": 200, headers: {}, body: "<h1>Hello!</h1>" }

And API Gateway knows exactly what to do. Before this, yes there was some extra config and it was not fun.

PS. Our AWS bill went down when we moved everything to Lambda but that was not the motivating factor for the switch


Is it possible that perhaps your EC2 instances were bigger than they should be, and perhaps to make Lambda work in satisfactory manner you also placed CloudFront in front of it?

Because those sites you mentioned (bustle.com and romper.com) look like something that could benefit a great deal from using CDN which would then drastically reduce need for large instances.


> I'm surprised to hear that Lambda gets costly. Is this from real experience or is it just theoretical? My impression was that Lambda saves you money by not having to pay for excess capacity.

I delve into this in detail here:

https://news.ycombinator.com/item?id=14075634

In short, using Amazon's own pricing example, yes, it's extremely expensive for production web app workloads compared to just running an autoscaling group with 10 (!) nodes on ELB/ALB, and the pricing disparity increases as load increases.

With that said, Lambda is a great fit for little tasks that will never need a whole server.




Consider applying for YC's Summer 2025 batch! Applications are open till May 13

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: