DEV Community

Discussion on: 5 Popular Use Cases for Going Serverless

Collapse
 
shaijut profile image
Shaiju T • Edited

Nice 😄,

Suppose I have a normal REST API which returns list of Products.

And then I have a ServerLess API which returns list of Products.

Can you tell which is better in this case , to use ServerLess API or Normal REST API ?

Also When should I NOT use ServerLess API instead prefer Normal REST API ?

Collapse
 
taavirehemagi profile image
Taavi Rehemägi

Hi, these are good questions.

There are many reasons why developers would choose a Serverless backend for an API. The main ones are a) to reduce operation management overhead, since the infra is managed by the cloud provider; b) reduce financial commitment by paying per usage; c) having an infra that is easier to scale to different levels of demand.

You would not use serverless if the reasons to choose it aren't worthwhile for your project/team or when its limitations are problematic. For example: AWS Lambda has an execution timeout of 15 minutes and a memory limit of 3 GB, which rules out long-running processes or highly memory-intensive workloads.

Collapse
 
shaijut profile image
Shaiju T

Thanks for the limitation of server-less. I also heard that server less API might experience a cold start, a delay in the response as it needs to power up an then answer you.

Check answer from below posts:

dev.to/shaijut/comment/12b0n

We should keep the limitation in mind. Thank you :)

Thread Thread
 
taavirehemagi profile image
Taavi Rehemägi

You can use provisioned concurrency to avoid cold starts: dashbird.io/knowledge-base/aws-lam....

Or even a third-party library (e.g. JS: npmjs.com/package/lambda-warmer or... pypi.org/project/lambda-warmer-py/) to take care of it themselves.

Cold start is not a “limitation” of serverless, it’s just a product of its nature - the same factor that makes serverless attractive also creates the incidence of cold starts but there are many ways to mitigate it, if it becomes an issue.