In the early days of the web, anyone who wanted to build a web application had to own the physical hardware required to run a server, which was complex and expensive. Then cloud computing came, where fixed numbers of servers or amounts of server space could be rented or purchased remotely. Developers and companies who rent these fixed units of server space generally over-purchase to ensure that an increase in traffic or activity will not exceed their monthly limits and break their applications. This means that much of the server space that gets paid for can go to waste. Cloud vendors have introduced auto-scaling models to address the issue, but even with the auto-scaling unwanted growth in the activity, such as a DDoS Attack, could end up being very expensive.
Serverless is a cloud-native development model that allows developers to build and run applications without having to manage servers. There are still servers in serverless, but they are abstracted away from app development. A cloud provider handles the routine work of provisioning, maintaining, and scaling the server infrastructure. Developers can simply package their code in containers for deployment. Once deployed, serverless apps respond to demand and automatically scale up and down as needed. Serverless offerings from public cloud providers are usually metered on-demand through an event-driven execution model. As a result, when a serverless function is sitting idle, it doesn’t cost anything.
Serverless compare to other cloud backend models
A couple of technologies that are often conflated with serverless computing are Backend-as-a-Service and Platform-as-a-Service. Although they share similarities, these models do not necessarily meet the requirements of serverless.
- Backend-as-a-service (BaaS) – is a service model where a cloud provider offers backend services such as data storage so that developers can focus on writing front-end code. But while serverless applications are event-driven and run on the edge, BaaS applications may not meet either of these requirements.
- Platform-as-a-service (PaaS) – is a model where developers essentially rent all the necessary tools to develop and deploy applications from a cloud provider, including things like operating systems and middleware. However, PaaS applications are not as easily scalable as serverless applications. PaaS also don’t necessarily run on the edge and often has a noticeable startup delay that isn’t present in serverless applications.
- Infrastructure-as-a-service (IaaS) – is a catchall term for cloud vendors hosting infrastructure on behalf of their customers. IaaS providers may offer serverless functionality, but the terms are not synonymous.
Cloud provider’s role in serverless computing
Under a serverless model, a cloud provider runs physical servers and dynamically allocates their resources on behalf of users who can deploy code straight into production. Serverless computing offerings typically fall into two groups, Backend-as-a-Service (BaaS) and Function-as-a-Service (FaaS). BaaS gives developers access to a variety of third-party services and apps. For instance, a cloud-provider may offer authentication services, extra encryption, cloud-accessible databases, and high-fidelity usage data. With BaaS, serverless functions are usually called through application programming interfaces (APIs). More commonly, when developers refer to serverless, they’re talking about a FaaS model. Under FaaS, developers still write custom server-side logic, but it’s run in containers fully managed by a cloud services provider. The major public cloud providers all have one or more FaaS offerings. They include Amazon Web Services with AWS Lambda, Microsoft Azure with Azure Functions, Google Cloud with multiple offerings, and IBM Cloud with IBM Cloud Functions, among others. Some organizations choose to operate their own FaaS environments using open source serverless platforms, including Red Hat OpenShift Serverless, which is built on the Knative project for Kubernetes.
Advantages of serverless computing
- Lower costs – Serverless computing is generally very cost-effective, as traditional cloud providers of backend services (server allocation) often result in the user paying for unused space or idle CPU time.
- Simplified scalability – Developers using serverless architecture don’t have to worry about policies to scale up their code. The serverless vendor handles all of the scalings on demand.
- Simplified backend code – With FaaS, developers can create simple functions that independently perform a single purpose, like making an API call.
- Quicker turnaround – Serverless architecture can significantly cut time to market. Instead of needing a complicated deployment process to roll out bug fixes and new features, developers can add and modify code on a piecemeal basis.
Happy Coding …