Like PaaS, serverless computing enables developers to build applications faster by eliminating the need for them to manage infrastructure. With serverless, the cloud service provider automatically provisions, scales, and manages the infrastructure required to run the code, e.g., AWS Lambda. Serverless architectures are highly scalable and event-driven, only using resources when a specific function or trigger occurs.
It’s important to note that servers still run the code. The “serverless” name comes from the fact that the tasks associated with infrastructure provisioning and management are invisible to the developer. This approach enables developers to increase their focus on the business logic and deliver more value to the core of the business. Serverless computing helps teams increase their productivity, bring products to market faster, and allows organizations to better optimize resources and stay focused on innovation.
Imagine a two-axis graph, where the vertical axis represents ‘increasing business logic focus,’ i.e., more focus on writing code, and the horizontal axis represents ‘decreasing stack implementation,’ i.e., less control of underlying infrastructure:
- Bare Metal: Here, we are responsible for everything, including hardware, OS, and patching, which is time-consuming.
- Virtual Machines (VM): Sourced from Bare Metal, we are still responsible for installing OS and patching, remaining time-consuming.
- Containers: These can run on any underlying infrastructure, but managing containers when scaling requires attention.
- Serverless: This abstracts from all underlying infrastructure. All major cloud providers have Function as a Service (FaaS), a compute platform for serverless. The focus is solely on business logic, linked to FaaS, with Functions being a single unit of your code, called by events (e.g., a button click), leading to an event-driven architecture.
Use case: A user on the client side uploads an image and submits it, initiating an event. The event invokes a function to resize the image, and the resized image is added to storage.
Benefits of serverless computing include:
- High availability: The cloud provider takes care of everything.
- Pay-per-use: You only pay for execution.
- Auto-scaling: Scales automatically based on demand.
- Faster time to market: Reduced infrastructure management accelerates development.
- Language agnostic: Serverless functions can be written in any programming language