Serverless technologies like AWS Lambda functions first offered in late 2014 is changing how developers deploy their applications. Developers saw the convenience and started using AWS Lambda for some basic use cases. As the technology matured, we are seeing more and more use cases for Functions as Service offerings like AWS Lambda, Zoho Catalyst, Azure Functions, etc.. With large scale adoption, serverless is becoming mainstream with increased enterprise adoption because it offers three main advantages to an organization: increased agility, seamless scalability and availability, and infrastructure cost savings. The key question is how does containers stack up against serverless in terms of these advantages.
- Increased Agility: In current software development model, developers should consider where the code is deployed and create the necessary configuration file and other artifacts to support the deployment process. For example, developers writing a microservice to be deployed in a Kubernetes environment should create the necessary Kubernetes artifacts to support the deployment. They also have to understand Kubernetes concepts, as well as figure out how to run the microservice and artifacts on their development machine to test them before pushing it to the DevOps pipeline. By contrast, with Functions as a Service like AWS Lambda or Zoho Catalyst, developers only need to worry only about the business logic they have to code, which could even follow a certain template, and then just upload the code to the serverless platform. This speeds up things significantly and helps organizations to ship products and solutions quickly and rapidly make changes based on feedback. Agility without the unnecessary operational overhead for developers is the biggest advantage for serverless
- Scalability and Availability: With traditional approaches, developers and DevOps teams have to factor in the scalability and availability for the application they build it is deployed. It typically includes the peak load expectations, whether an auto-scaling is needed or a static deployment will suffice, setting up the necessary automation for auto-scaling and requirements for ensuring the required availability. This is the case for applications deployed on virtual machines as well as containers. Serverless platforms remove the need to worry about these factors, since they are capable of executing the code when needed, and ensuring availability. The scalability is easily achieved by invoking the functions parallely to meet the load. It is the responsibility of the cloud provider to handle this in a seamless way. So, scalability and availability are provided by default and handled by the cloud provider without any overhead for the developers
- Infrastructure Cost Savings: When we deploy an application in a production environment, we generally need to keep it running 24×7 since in most cases it is hard to predict the specific time periods the app needs to be available. That means there are many idle times between requests even though we pay for the infrastructure full time. For an organization that has to deploy hundreds of services the costs can escalate quickly. With serverless functions, it is guaranteed that your code will get computing resources allocated only when it is executed, which means you pay exactly for what is being used. This can cut costs significantly. However, this also constraints users from running only certain types of use cases
How is serverless computing different from containers?
Containers are essentially what the name describes: a comprehensive software encapsulation that gets delivered and used as a standalone application environment. The most common form of this is how applications get distributed at runtime. Everything and anything that’s needed to run and interact with a piece of software gets included or packaged together. That often entails bundling the software code, runtime and system tools, software and foundational libraries and default settings. In the case of containers – through platforms like Docker – they help solve the more common problems that arise from cross-platform use.
When moving from one computing environment to another, developers often run into obstacles. If the supporting software is not identical, it can cause a series of hiccups. And since it’s not uncommon for developers to move from a dev environment to a test environment, or even from staging into production, this becomes a widespread issue. That’s just concerning the software itself, as other issues can appear from network topologies, security and privacy policies, as well as varying tools or technologies. Containers solve this by wrapping everything up nicely into a runtime environment. Even though containers offered this advantage of encapsulating entire environments and removing the friction due to different environments on DevOps pipeline, they came with operational overhead which became a burden for developers.
In the case of Serverless, all these tasks are completely abstracted away by the cloud service provider, giving developers a simple interface to deploy their code. Developers need not bother about the application dependencies, environments, etc.. They just need to encapsulate the business logic into code and this can then be deployed onto serverless platform. Developers need not worry about the deployment environment and since the same service will be used for both development and production, they are not faced with the issues of making the code work in different environments. The entire heavy lifting is done by the cloud provider and the developers focus on the innovation.