6 ms·
Can someone provide good examples of why you would use a Lambda to respond to traffic instead of regular VPS? Is it just to save transfer costs inside the AWS n
by Xeoncross 9y ago
Can someone provide good examples of why you would use a Lambda to respond to traffic instead of regular VPS? Is it just to save transfer costs inside the AWS network? Go can serve hundreds of thousands of connections a second on a $20/m DigialOcean/Linode/Scaleway/Volr server.
- benmanns 9y agoI like that Lambda can scale down to 0 and up to infinity without changing your architecture. However, a $20 droplet is probably a better value as I've spent many hours banging my head against AWS Lambda docs, Serverless framework incantations, alternative state storage, etc.
- bpicolo 9y agoYou can do similar with e.g. elastic beanstalk. You still need a metric for autoscalers, but overall the scaling works well. Probably worse for high-burst sorts of traffic though.
- lev99 9y agoElastic Beanstalk requires more devops type stuff then lambda.
- tnolet 9y agoThe Serverless framework is one of the most baffling and over engineered things I’ve seen in a long time. Instead of making thing easy it just a jungle of options and weird configs. No idea why it is so popular.
- quotheth 9y agoYour post lacks substance so it's hard to respond to (you criticize it as 'over engineered', not rally something I know how to respond to). One obvious concrete benefit of serverless is not managing infrastructure.
- thefounder 9y agoYou can execute Lambda on CDN(cloudfront) so that's really a deal breaker. Otherwise I wouldn't bother.
- tnolet 9y agoSay you have a pet project that does 500 to a 1000 API requests per day. If you stick that into a Lambda, you have 0 running cost are close to zero due to AWS free tier.
- Xeoncross 9y agoAre you talking about a project that does 1000 AWS API requests a day?
- seangrogg 9y agoNot the parent, but I assume he means an application that itself takes in 1000 requests per day. At the free tier your options include, on a monthly basis: * a single EC2 t2.nano box with 0.5gb memory and 1vcpu * 1,000,000 requests (or 40,000 gb-seconds worth of requests) to your lambdas Assuming you're taking in less than 1m requests monthly the lambdas will handle traffic spikes much more gracefully than the small VM will; as well, since it's not an either-or proposition this also means you still have a free VM you can do something with.
- Shoothe 9y agoI wouldn't be so sure. I've got a simple email to http service running on AWS and while I'm sending no more than 50 emails to this service I still get billed cents. If I was thinking about running something like this in production I'd definitely use a cheap VPS.
- michaelbuckbee 9y agoFor a pretty traditional CRUD web app or mostly static with a few dynamic parts website something like Lambda is probably not the right answer. Where I think Lambda is interesting is in areas of high variability. The sort of canonical example is image resizing. While you certainly can do that on the same machine as your web server it makes a lot more sense to put the images to a S3 bucket (keeps them off the server, out of versioning, etc.) You can tie a Lambda to a S3 create file event. So when the file hits the bucket it automatically gets resized into all the appropriate sizes needed elsewhere on the site. This setup sidesteps a ton of potential issues, makes your app much more robust and is pretty easy to get going.
- jitl 9y agoYou don’t need to screw around with creating boxes, patching them, etc. if you’re tiny and only have one or two boxes running one or two services, then there’s not much point automating anything. If you’ve got 100s of services or handle huge load spikes, why spend extra rev cycles on concerns like “do I have enough machines” or “are these things patched?” or even “how do I make sure my service stays up?”
- acdha 9y agoIt avoids ops work for bursty workloads: if your app sees consistent traffic it’s probably overkill, but if you have fluctuations where the work is, say, ranging between 0.5 and 20 servers’ worth you can avoid needing to setup that infrastructure yourself. I use it for creating image derivatives on a project which doesn’t have dedicated servers for that task. Every S3 upload triggers a conversion task which saves the result to another bucket. The long-term average number of servers is close to zero since the content is released in batches but when a new batch arrives it’s reliably done in 5 minutes no matter how large it is, and I don’t have to manage autoscaling policies, server builds, etc. – just write a couple dozen lines of Python. For a sufficiently large amount of work the cost tradeoff might go the other way but in my experience there are a LOT of tasks which are below the threshold where the savings in server time is greater than the savings in sysadmin time.
- skywhopper 9y agoFrom my perspective (working at a large SaaS provider built on AWS), we don't use Lambda for serving client requests. Rather, we use it for internal glue between AWS services. If what you actually want to do is relatively simple, eg, read a JSON message from an AWS service, like a Cloudwatch Alert, an autoscaling action, or an API call logged in Cloudtrail, you can easily wire those events up to Lambda functions for which you only need to code the bit that parses the JSON and does something in response. So then if the event happens once a day, once a month, or 50 times a second, you don't have to actually worry about calculating scale, except for cost purposes. But if it's a rare event, then Lambda comes in way cheaper than a $20/month server you have to maintain somehow. Of course, you can build apps directly on Lambda, but there's a lot of tools you'll miss when you get around to going full scale production. But for simple glue to wire up actions to events, it's actually a pretty slick service.
- jdc0589 9y ago100% agree. I know some people are building full on apps with lambda, but I'm just not a fan of that use case. Lambda is PERFECT for devops groups. Need to keep a security group in sync with the IPs some 3rd party service publishes? cloudwatch cron + lambda function. Need to do some weird scattering in response to s3 object created events? lambda function. want to roll some of your own automation to manage and respond to health events with services you host? some event stream + stepfunctions + lambda functions.
- dstaley 9y agoI use Lambdas for just about everything. The API for my package tracking app is a Lambda function, and I have another function that checks a few subreddits for specific keywords and emails the posts to me. I have another Lambda that checks my cellular data usage every half hour and sends me a text when I'm close to my data limit. The signup form for a Slack community I run is powered by Lambda as well. If I wanted to run each of these in their own isolated server, it'd be at minimum $4/service/month for a t2.nano instance, running me $200/year. Thanks to Lambda's generous free tier, I've paid literally nothing for these services. I could handle 100x the current load and still pay nothing.
- Karrot_Kream 9y agoNot sure how tied you are to AWS for these things, but GCP has an f1-micro compute instance in their free forever list of services.
- barsonme 9y agoA use case is taking files from S3 and then doing something with them. It's much easier an efficient to set up a Lambda function that gets "pinged" by S3 every time a new file is uploaded than it is to poll S3 for new files.