Serverless computing (as the name suggests) allows you to build and run applications without the help of servers. There is no additional need to maintain infrastructures, servers, or other overheads for deployment of the application onto the servers and installing additional software. For day-to-day development, all you require is cloud managed services and a regular laptop. Code snippets are designed independent of each other and perform a single task at a time. Although serverless has been around in the form of Backend-as-a-Service or BaaS, but it has reached a different scale today with AWS Lambda, Azure and Google offering their own serverless solutions.
Why we need serverless?
Developers and architects choose serverless when they don’t want to deal with servers and all associated operations to keep them up and running at scale. Instead, they go for different services that are secure, available, pre-provisioned, and pre-scaled. Here are a few advantages of such computing platforms:
- Reduced operational complexity: No servers to be provisioned for serverless jobs.
- Cost-Effective: Scale out at minimal costs, no operating systems and load balancer maintenance.
- Scale in seconds: Scale out in no time.
- Choice of coding languages: Choose language of choice to code.
How to design for serverless architecture?
To understand how we can convert a normal cloud-based application to a serverless application, let’s take an example of a reference application on AWS.
Figure 1: Traditional Cloud to serverless [Source]
Figure 1 shows two application architectures, wherein the left side is a traditional cloud (AWS) based architecture, where the static content is being delivered from a simple storage service (S3). A load balancer balances the load between two web servers which are EC2 instances and are deployed in two availability zones for disaster recovery. Below that there is one more load balancer which is there to manage the load of app servers, again based on EC2 and are deployed in different availability zones. Finally, we have relational databases like MySQL deployed in different availability zones in high availability mode. This represents a traditional cloud-based architecture that we follow in most applications.
The right side of Figure 1 depicts a serverless architecture for the same application. Here AWS Lambda is being used which is a mature and powerful serverless computing framework. To integrate these Lambda functions API gateways shall be created, which will be consumed by the web tier. So, there are RESTful endpoint for all the Lambda functions. The performance, availability and maintenance will be taken care by AWS out of the box and will look over the code as well. Security can be assured through Identity and Access Management(IAM) and there is no need to worry about the underlying infrastructure. Lambda supports NodeJS, Python and Java as the programming languages and each language has its own API to support development.
While Lambda has lot of advantages, few limitations must be considered while designing serverless architecture in AWS:
- Maximum duration of a single request cannot exceed 300 seconds i.e. 5 minutes.
- Deployment package size cannot be more than 50 MB.
- Maximum number of processes and threads is 1024.
Architects need to design serverless considering the inherent limitations. If the limits of scaling are high, the provider needs to be informed to provision specific data-centers.
The rise of modern mobile and IoT applications are playing an important role in the rise of serverless computing platforms. Cloud providers are offering Serverless Application Repository for users to discover, configure and deploy serverless apps and their components on the cloud. Explore our cloud offerings and for a more detailed discussion on our cloud computing solutions, feel free to reach us at firstname.lastname@example.org
Cloud Computing, Cloud, AWS, Serverless Computing