Serverless Architecture: Hype or Godsend?

Posted by Ajay Babar · 24 Feb, 2020 · 8 min read
 Serverless Architecture: Hype or Godsend?

Serverless architecture has been a buzzword in the industry for quite a while now and it’s there for the right reasons. Serverless is revolutionizing the way software is developed for many products and those who have taken the leap have seen enormous benefits. Serverless is beneficial especially for those who want to prepare themselves for unforeseen workloads and not focus on managing infrastructure themselves.

Mobile apps have started earning more revenue than the entire Hollywood film industry since 2015. That is serious money spent on making games, apps, and such. If your app freezes or crashes, only 16% of your customers will think of giving your app a second chance.

Thus, it becomes important for businesses (especially mobile apps) to make a great first impression and delight the customer at every step of the way (especially if your app goes viral or has to scale up quickly).

Here are a few latest news on serverless architecture and Mobile Apps that you might be interested in:

With companies facing challenges in maintaining and updating servers, serverless architecture has been getting more attention by the day.

What is serverless architecture?

Serverless architecture is an ecosystem wherein the entire backend logic is split into multiple individual components called as functions. These functions run in a predefined environment, consume some input and produce output as if it were a separate API.

What are the benefits of serverless architecture?

The major benefit of a serverless architecture is that it is deployed 100% over the cloud with high flexibility over compute size and choice of programming language. Thus you can easily scale without limit, code parts of your application in Javascript and the other in maybe Ruby.

The serverless architecture consists of three major components:

  1. Router
  2. Function as a service (FaaS)
  3. Database for persistent storage

In this article, we will primarily explain how businesses are reducing their TCO (Total Cost of Ownership) for mobile applications built by leveraging serverless backends.

Understanding Backends for Mobile Applications

Numerous companies around the world are running their business today solely using mobile apps. Some popular names include:

  • Instagram
  • TikTok
  • Whatsapp
  • Uber
  • OLA

These companies basically have a backend application powering up their mobile apps. The backend of such mobile applications focuses on providing data to the frontend after required processing.

Traditionally, the backend of a mobile application is developed using popular programming languages like Java, Python, Go, NodeJS or Ruby. These backend applications run on virtual machines, or shared servers explicitly configured to run the corresponding application. The backend app connects with the desired database and exchanges data for the frontend. The entire execution is stateless, where the authorization is taken care of using an authentication token.

Conventional backend architecture for mobile application

Conventionally, the backend applications continuously run on a server machine of defined configuration. The companies either opt for shared servers pre-configured for a specific service or they choose to utilize the dedicated device for better performance.

The shared servers (such as Hostgator and Bluehost) restrict the companies to utilize a specific programming language (such as PHP) and configuration (such as WordPress/Magento). The possibility of scaling up is limited.

On the other hand, with the dedicated machines, they normally come without any pre-installed application servers. We need to configure the machine, perform installations and then run the application. This process is not only time-consuming but also costly since someone needs to invest time for the same (usually done by a DevOps Engineer).

Considering the current state of mobile applications, the backend applications normally require very little processing or compute power but greater bandwidth i.e. I/O (Input Output Operations). The sole purpose of the backend in most cases is to provide the means to exchange data. The usage of the backend highly depends on the number of active users, the amount of data to be processed and the bandwidth utilized. However, the costs of owning and managing a server remain the same irrespective of the usage. This leads to recurring costs for companies.

In addition to the recurring costs, if the application progresses well and the user base rises exponentially, scaling up would proportionately increase the expenses and involve additional installation efforts.

Serverless Architecture Benefits — The power of Serverless Backend

After understanding the problems with the dedicated compute, let us now understand how serverless architecture stands against it. With serverless architecture, you utilize an ecosystem over the cloud where you are free to run code in a variety of popular programming languages. This ecosystem has a flexible compute size for every Function, which means you can specifically optimize the computational power as per the function’s need.

These ecosystems, also known as Function as a service, are charged at the granularity of per millisecond execution that is too corresponding to the computational power used. This means the function costs us ZERO when not in use. Moreover, every function execution is in a dedicated environment that ensures that the function never runs out of juice.

Let us understand the benefits of serverless architecture for the backend:

  • Network Security

One of the top benefits of serverless architecture is that these functions run within the Cloud ecosystem that is built to withstand the majority of the attacks and security vulnerabilities. This means your execution is far more secure than the regular dedicated servers. The functions can be executed within a private VPC where no external system is allowed to connect. This will ensure that your function is never misused.

  • Secure Authorization Gateway

The functions are executed based on the request routing programmed at the gateway of the serverless ecosystem. Based on the routes, you can configure the authorization for each function. The intermediate routing gateway ensures that your function is never executed for an authorized request. Moreover, it also sanitizes the input data to secure your function from any unexpected request data. Hence, it becomes one of the unmissable advantages of serverless architecture.

  • Unlimited compute

Another benefit of serverless architecture is that the compute power in the same is on-demand. This means, irrespective of the number of users, you do not need to worry about running out of RAM or bandwidth ideally. Every function execution instance has its dedicated memory and processing power. The available RAM ranges from 128MB to 3GB in various cloud environments. Moreover, even the costs for the function execution is proportionate to the amount of memory utilized. Thus, despite the high scalability, your costs remain optimum.

  • Optimized costs

As discussed before, the majority of the time, the backend server of mobile application stay idle. It would not make sense to pay for the server when it is not really being used. With Serverless architecture, you only pay for the amount of time you utilize the cloud. The entire ecosystem is free to use for storage of your function and mapping your routes (negligible costs).

  • Freedom of programming language selection

This is the most crucial benefit of serverless architecture. Every function has its ecosystem to run on. This means you can choose the programming language for every function to be different. For instance, you need python for some faster data processing, but nodeJS is simpler for data exchange, you are free to do so. The cloud environments offer almost every popular backend programming language.

Serverless Architecture AWS- Going serverless with AWS

One of the most commonly asked questions is- What is AWS serverless architecture? So, here is the answer-

Amazon Web Services (AWS) is the most popular platform today for going serverless. It is preferred because the components have been tried and tested exhaustively by numerous organizations. Let us understand the AWS ecosystem of the serverless architecture and map our backend components to go serverless.

The below image shows a high-level overview of the serverless architecture. Let us discuss each of the components to understand how it would fit in for a mobile backend.

AWS Cloudfront & WAF

AWS Cloudfront and Web application firewall together form the entry point for the API calls. Every API call that is made from the mobile application needs to pass through these layers. These layers are responsible for filtering out spam requests, caching the data for the requests and optimizing performance by routing the request to the right region.

AWS API Gateway

This is an important component of the serverless architecture. AWS API gateway takes care of the routing of requests to the right AWS Lambda functions. AWS API gateway is responsible for the below items:

  • Authorizing the request
  • Mapping and validating headers and the request body
  • Routing the request
  • Mapping the response body
  • Returning the response

AWS Lambda

AWS Lambda is the core compute part of the serverless architecture. With AWS Lambda, the developers get the facility of running function as a service. AWS Lambda today supports the majority of the backend programming languages like Python, Java, NodeJS, Go, Ruby, PHP, .NET and others. Moreover, AWS also has an SDK for most of the programming languages to make access to AWS services easier.


Finally, the last component of the serverless architecture is storage. AWS DynamoDB and AWS RDS are two database services by AWS that provide NoSQL & SQL databases, respectively. Both the database services provide an auto-scalable infrastructure where you are charged based on your usage. Additionally, they also have automated backups to ensure that your desired data is never lost.

These components collectively make up the serverless architecture on AWS. Companies around the world have been shifting their backend workloads to AWS serverless to reduce their recurring cost commitments, and leverage scalable cloud computes to keep up the performance.

Long Live Serverless Architecture

Serverless architecture is the future of mobile backends owing to the need for cost optimization. Serverless architecture not only allows the developer to have a flexible compute at the optimum cost but also allows him to be free from any installation and configuration efforts involved.

With security laws getting stricter day by day, handing off the security to the expert in the field is always the right choice. With serverless architecture, you precisely do this. You hand over the majority of the security aspect to the Cloud service provider. Thus, going serverless is definitely a move to consider in your next technology upgrade plans.

Youtube Playvideo
Subscribe to The Friday Brunch
Our twice a month newsletter featuring insights and tips on how to build better experiences for your customers

Have a product idea?

Talk to our experts to see how you can turn it
into an engaging, sustainable digital product.