The Serverless Model for the Uninitiated
“Serverless” is a buzzword that is thrown around especially in the cloud industry. For the inexperienced, it may seem intuitive – “server” and “less”. It does not mean having less servers, but it actually refers to lesser (or no) management of servers. Serverless services allow developers to build and run applications without the need to manage servers since the cloud service provider handles the maintenance of the server infrastructure. Serverless applications have the ability to respond automatically to demand, and scale as required.
In a typical Infrastructure as a Service (IaaS) cloud computing model, end-users pay a cloud service provider for servers (running 24/7) to run their applications. It is the end-user who is responsible for scaling up during periods of high demand and scaling down when the additional capacity is no longer required. On the other hand, with serverless architecture, resources are provided automatically when required. When applications are running, the cloud service providers dynamically provision resources for them based on demand. End-users only pay for what is used, and when the applications stop running, the end-user stops paying.
Serverless Functions
One example of a serverless service is serverless function. Serverless functions potentially lasts for seconds and is designed to be triggered by a specific condition, such as placing an e-commerce order. A typical serverless function process would have the following steps:
1. Writing a function; the developer writes a function that fulfils a specific purpose
2. Defining an event; this event allows the cloud service provider to execute the function by defining a trigger event.
3. Triggering an event; a user triggers the defined event such as clicking a button
4. Deploying and executing a function; the cloud service provider starts a new instance of the function
5. Passing the result to the client.
If the service gets a lot of requests, an appropriate number of instances are made available, and if the requests drop, the resources used scale down accordingly. This way, the customer (of the cloud platform) only pays for the resources the function used. Serverless functions are applicable in many situations, and they affect the way we carry out certain tasks. Serverless functions are often used in building websites and web applications as they allow developers to focus on the core product without worrying about the maintenance of the cloud infrastructure. Serverless functions are also used in routine tasks, as it allows for automation of tasks that must be performed at a specific time or interval.
Benefits of The Serverless Model
Building upon a serverless architecture brings about a myriad of benefits, mainly, not needing to manage the infrastructure. This is a major benefit for developers since the responsibilities of server and hardware maintenance are now the cloud service providers’.
Serverless services are also beneficial to business owners as it optimises the costs of running services, largely due to its auto-scaling capabilities. Since services’ resources are scaled based on demand, there is no need to cater for scenarios where resources are found wanting in times of high demand. As cloud service providers only charge based on usage, serverless services allow end-users, which include business owners, to only pay for the resources used. They are not required to pay for idle CPU time and/or unused space. .
Finally, using a serverless development model, allows developers to add and modify the code piecemeal. Bug fixing and adding of features for applications will be done significantly faster.
Drawbacks of The Serverless Model
Despite the numerous benefits of using a serverless architecture, they are not without its cons. Using serverless services can quickly turn expensive, especially when resources are required and usage is sustained in large amounts. It would be cheaper if resources are purchased and reserved beforehand, since usage is expected for an extended period of time. Additionally, there are several Platform as a Service (PaaS) offerings that can manage infrastructural overheads, that include security patches, auto-scaling, and monitoring that can bridge the gap between serverless and server-based managed offerings – for a portion of the price. In some cases, end-users can save up to 80% when running their applications server-based on cloud.
Another issue is being vendor locked-in. Many serverless services are proprietary to that specific cloud service provider and cannot be migrated from one cloud service provider to another. This is due to a lack of consistency between cloud service providers, meaning the same serverless services can be extremely different in form from one cloud provider to another, even though its main functions are similar.
For the uninitiated, I hope this article helps to clear up some misconceptions surrounding the serverless model. It is evolving at an unprecedented rate, and as we move towards Serverless 2.0, cloud service providers will continue adding on to their serverless offerings to make it more suitable for general-purpose business workloads.
References
https://www.redhat.com/en/topics/cloud-native-apps/what-is-serverless
https://enterprisersproject.com/article/2019/2/serverless-how-explain-plain-english
https://www.splunk.com/en_us/data-insider/what-are-serverless-functions.html#:~:text=Serverless%20functions%20are%20a%20single,all%20architectures%2C%20including%20cloud%20infrastructure.
https://hackernoon.com/cons-of-serverless-architectures-7b8b570c19da