In Cloud we have the concept of PAAS where developer does not have to get into hassles of worrying about the infrastructure and can directly focus on the code. In serverless programming (using AWS lambda or Azure Functions) too, developer does not have to worry about the server (which also comes under infrastructure). What makes serverless programming different from using PAAS service? Thanks
With PAAS services, you build you ruby on rails/django/spring/express app, and PAAS provider takes care of provisioning this app on its infrastructure. You still have to make your application scalable, and specify to PAAS provider how to scale your app (like you need to provide auto-scaling of database, app servers, etc.
In serverless programming. you split your application into multiple functions (some functionality that needs a few minutes to complete, but not long), each of which will be triggered by some event. Events could be an http request, or message queue event. So, you need to redesign your app to be reactive (event-driven) - and a collections of functions. For example, an http request will trigger a function A, which may emit a message-queue event, which will trigger another function B.
Then you just specify this triggering event to function mapping to your provider, which takes care of scaling each function dynamically, based on the load.
Thanks. That explains it well. I am just wondering that when serverless is so beneficial then why was it not designed to let all PAAS services have automatic scaling feature by default like the case of serverless service like AWS lambda/ azure functions.
Yes, you can. Just that you need to have minimum number of servers for your application (at least 1), and that consumes resources, and costs money.
In case of serverless, nothing is provisioned, unless the triggering event arrives.
And you get charged per event and per unit of consumption time.
Redesigning the application so that it's collection of reactive components, that is, functions is not an easy task. Think of converting your spring MVC app into multiple functions triggered by different API requests.
Also, it takes a few seconds to start a AWS lambda, called cold start time. So, your performance will suffer, if your function is not consistently getting triggered.
I am just thinking that why dont they change the PAAS components like Elastic Bean stack/App service etc to make them like serverless where no scaling would be required. There must be some reason why they dont.
Monica Shiralkar wrote:I am just thinking that why dont they change the PAAS components like Elastic Bean stack/App service etc to make them like serverless where no scaling would be required. There must be some reason why they dont.
Not everything is well suited to serverless/functions/lambdas. For example, you could have a process that takes an hour to run.