Let's talk about the elephant in the room; Serverless doesn't really mean that there are no Software or Hardware servers. It just means that from Software Development perspective, servers are abstracted and outsourced to another entity, so you don't need to worry about it. Serverless Computing is also known as FaaS (Function as a Service).
Serverless is currently a hot topic in many modern architectural patterns. You can imagine Serverless as Microservices broken down further, per function. It has all the advantages of Microservices and allows for more granular control and scale. In fact, some people think that Serverless is the natural progression after Microservices.
Serverless systems are still in their infancy. There will be many advances in the field over the coming years and it will be fascinating to see how they fit into our architectural toolkit.
Advantages and Disadvantages of Serverless
- Cost - Serverless Computing is more cost-efficient than having a fixed quantity of servers. This reduces periods of underutilisation or non-use.
- Rapid Development - You can quickly deploy a function without having to worry about infrastructure resources and growth.
- More Granular Control - The smallest deployable unit is no longer a microservice but rather a function.
- Vendor Lock In - At least for now, FaaS comes with a Vendor Lock In. Whether you choose Azure Functions or AWS Lambda, you cannot easily switch to another.
- Performance - Serverless Functions that are used less frequently may suffer from warmup response latency, where the infrastructure needs some time to deploy the function.
- Execution Duration - Serverless Functions are typically limited in how long each instance is allowed to run. Azure Functions don't have this restriction, but on AWS Lambda, functions are not allowed to run for longer than 5 minutes. This means that certain tasks are not suited to be FaaS Functions.
- Monitoring and Debugging - Typically, with Serverless Computing there is no ability to dig into more detail by attaching profilers, debuggers or APM tools.
- Stateless - Serverless Functions are stateless; you should assume that for any given instance of the function, everything will be lost. This has a huge impact on application architecture, however having said that, it's not necessarily a bad idea. In fact, the 12 Factor App has this same recommendation.
So, how do I Serverless?
Serverless can be achieved on Clouds. Cloud Computing has been disruptive these past few years and the emergence of Serverless is just another example of why Cloud Computing is the future.
On Public Clouds:
On these Serverless Clouds, developers can deploy their code and configure it to run continuously, on a triggered event or via a Web API.