5 ms·
My experience with serverless (mostly AWS Lambda) is that I've found 3 major use cases where it's been a very successful choice: 1. as a cron-style job (e.g. d
by sgtcodfish 7y ago
My experience with serverless (mostly AWS Lambda) is that I've found 3 major use cases where it's been a very successful choice:
1. as a cron-style job (e.g. download a file every hour and put it in S3, or connect to a DB and do some smaller processing task)
2. as a responder to (or processor of) cloud-based events (e.g. receiving from a stream, reacting to an instance shutdown notification or an alarm)
3. as a backend for a small REST API (especially for heavily cacheable APIs)
For all 3 cases, assuming the task isn't hugely inappropriate and you've got a bit of infrastructure-as-code lying around which can be repurposed, serverless has lead to a massive time saving for me for several tasks, for very little money and with basically no maintenance effort required.
There's definitely a tendency towards smaller tasks, though. Ultimately serverless necessarily means giving up control of your infrastructure and removing a lot of customization or specialization options; that means that at a certain scale or level of complexity, it just isn't an appropriate choice either for cost or performance reasons - but that's fine, it doesn't have to solve all problems. It has its niche, and it's quite easy to go from a quick Lambda to a container-based or VM-based alternative.
- yani 7y agoDownloading files is something I would not be using serverless due to the timeouts - 900s
- mcintyre1994 7y agoIf you're downloading a file that takes anywhere near that long every hour then it's probably a bad choice for cost reasons too. Most files aren't big enough to take 15 minutes to download though.
- bmm6o 7y agoIf you're at the point where you're worried about the timeout, you should also be worried about the disk space available to your Lambda. The file should be stored in and served from S3.
- scarface74 7y agoYou can stream a file directly from a source to S3.
- sgtcodfish 7y agoAs others have said, if you're gonna be reaching that kind of timeout, the use case would come under this caveat I mentioned: > assuming the task isn't hugely inappropriate We have a couple of cases where reasonably small files (< 100MB but it'd work with larger) need to be downloaded from one place and placed in another, potentially with an ETag check to prevent redundant uploads/downloads. Lambda is perfect for that.
- slothario 7y agoI switched a company's web API with background tasks to a serverless architecture. In some ways it's kind of magical, because it means we just need a few web API boxes and a bunch of services which scale automatically. However, debugging is a major PITA. If I could go back and do it again, I would be less zealous and only move truly computationally-intensive services to Azure Functions. It turned out one major service I moved to functions could have simply been fixed to use the ORM correctly, and if I had done that it wouldn't have significantly increased the server load. Also, do not move a task where ordering matters to function fed by a queue. Just some thoughts from a mid-level programmer who was given keys to the kingdom and re-architect everything.