Web and mobile app development company
Do you Know Everything About Serverless Architecture?

Do you Know Everything About Serverless Architecture?

Hello everyone. In this article, we will look at FaaS (Function as a Service) Then we will explore the various serverless offerings in AWS, and then we will see the use cases, benefits, and drawbacks of these modern architectures. I have also clearly explained the differences between Serverless and other cloud models like PaaS, BaaS, IaaS, and SaaS.

Image Source:

Software systems have been deployed onto the racks in data centers, which were then called on-premise. After the advent of cloud computing, servers moved to the cloud and companies started using the servers from cloud providers. Even then, the companies need to configure the servers (Memory, CPU, Networking, etc) on the cloud based on the application requirements. There are different types of services like PaaS, IaaS, SaaS, etc. The next evolution was Serverless Architecture.

So what is a Serverless Architecture? We don’t need servers to deploy the application? No, that’s impossible to do. Isn’t it?

We definitely need something for our application to run on and yes we need servers but we don’t see them. We don’t manage the servers and the cloud providers will take care of it. Developers can write and deploy code, while a cloud provider provisions servers to run their applications, databases, and storage systems at any scale. This increases the efficiency of any software development team by delegating the server hardware maintenance, software, and security updates, creating routine backups, etc to third-party providers, and enabling them to focus on writing application code.

Function as a service (FaaS)

Serverless is often referred to as Function as a Service (FaaS) because originally serverless started as Function-as-a-Service (Faas). It was offered for computing but then it has expanded to various types of cloud services.

In FAAS, developers write application logic in a function that is triggered by an event. These functions (AWS Lambda) are deployed to a cloud provider like AWS and then they are configured for various things like

  • Memory
  • Runtime
  • Timeout
  • Concurrency

The event can be anything like a request from an API gateway or notifications from other services. The functions will be configured to execute upon the invocation of the event. When a function is invoked, the cloud provider will execute the function by running them on a container if there are instances running currently. If there are no instances running already, it spins up a new container to execute the function. But this whole execution process of running servers and shutting down is hidden from developers which brings convenience and faster time to market.

As shown in the above diagram, when an API is invoked by a web or mobile client, then the Lambda function mapped to that particular API is invoked. The functions are

  • Stateless and easily integrated
  • Ephemeral — Can run for a very short time.
  • Event-triggered
  • Fully managed by a cloud provider — Pay as you use

100% Serverless Architecture — beyond FaaS

Serverless started with FaaS ( Function as a Service) but it is way beyond that. Serverless has expanded to various services across the stack that can respond to requests and events and handle them by provisioning the servers without DevOps / Developers managing them. Nowadays many applications are 100% serverless and one such example is shown in the diagram below.

Every cloud provider provides Serverless services but in this article, we will take the example of AWS

In addition to FaaS, these Serverless services include

  • Serverless Computing

The compute serverless provides infrastructure for developers to perform computing operations using Functions or applications running in Containers. As we saw, AWS Lambda is the FaaS offering from AWS. AWS Fargate is a serverless offering of Container services that do not need server management by the developers or DevOps.

  • Serverless Databases

Different types of databases are provided in the serverless offerings. It ranges from SQL and different types of NoSQL databases. AWS Aurora Serverless and AWS DynamoDB etc are some of the examples of Serverless Databases

  • Serverless Storage

One of the most commonly used services in AWS is S3 which stands for Simple Storage Service. It is a bucket type of storage based on the object storage model and it can scale to any limit quickly without managing a separate storage server for our application. It is ultra fast and secure.

  • Serverless Event Streaming and Messaging

Event Streaming and Messaging are the integral heart of the modern microservices architecture. AWS provides services like SQS Queues, SNS Topics, Amazon Event Bridge, Amazon Kinesis Data Streams are some of the offerings from AWS for streaming and messaging. They facilitate huge volumes of data processing by scaling quickly and communication in the application without managing servers.

  • Serverless API Gateways

API Gateways are the face of the backend application and sometimes they are called BFF (Backend For FrontEnd). Without managing servers, developers can just focus on Authentication, API Rate limiting, CORS, API Usage, and integration to compute services on the backend like AWS Lambda.

  • Serverless Logging and Monitoring

Logging and Monitoring are very critical to any application and using them without managing servers on our own is very efficient for the application. AWS Provides Cloudwatch for aggregating the logs from various sources and provides dashboards for monitoring as well.

  • Serverless Analytics

Instead of managing a traditional data warehouse with variable workloads with unpredictable spikes, developers can use Serverless Analytics solutions like Amazon Redshift Serverless. It makes it easy for Developers, Data Scientists, and Analysts to work across databases, data warehouses, and data lakes to build reporting and dashboarding applications, perform real-time analytics, Collaborate on data, and build and train machine learning models.

  • Serverless CI/CD

Serverless CI/CD is a continuous integration and deployment service that is optimized for serverless workflows. AWS brings in a complete set of CI/CD developer tools to accelerate software development and release cycles. AWS CodePipeline automates the build, test, and deploy phases of the release process every time there is a code change, based on the defined release model.

How does serverless compare to other cloud models?

There are a lot of terminologies used in the cloud like BaaS, PaaS, IaaS, etc, and this lets us see how they compare with Serverless

Backend-as-a-service (BaaS) is a service model where a cloud provider offers backend services like database, storage, authentication, push notification, and hosting. This will help mobile or web developers to focus only on front-end code. They are similar to Serverless architecture in the way that developers do not need to maintain the infrastructure but they are different from Serverless in the way that serverless is event-driven and they are highly scalable and run on the edge.

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. They differ from serverless applications in terms of scalability and start-up time. PaaS services may not run on the edge and have more cold-start time when compared to Serverless

Infrastructure-as-a-service (IaaS) is the overall offering from cloud vendors that specifies that cloud providers provide all the infra for an application instead of the team handling on-premise servers. In contrast, serverless architecture apps are launched only as needed as an event triggers app code to run and the user stops paying when the code finishes executing. IaaS can provide Serverless but IaaS is not just Serveless.

Software-as-a-service (SaaS) meets many of the main requirements of a serverless application as a zero-hardware requirement to deploy, zero server processes to manage, inherent scalability, and high availability. SaaS differed from Serverless in terms of pricing. SaaS is always priced using a user-based subscription model, though sometimes you may pay for each user, and in some cases, you may get some number of users per pricing tier. Some examples of SaaS are Google Workspace, Zoom, Dropbox, Salesforce etc.

 

Serverless Architecture Use Cases

Serverless architecture is best used to perform short-lived tasks and manage workloads that experience infrequent or unpredictable traffic. The main use cases for serverless include

  • Trigger-based tasks
  • Batch Processing
  • Building RESTful APIs
  • Asynchronous processing
  • Security checks
  • Continuous Integration (CI) and Continuous Delivery (CD)
  • Process data streams
  • Chatbots

Benefits of Serverless

There has been a significant increase in serverless adoption in recent years and some of the benefits of Serverless are

  • Pay for execution only
  • Cost-effective performance
  • Improved productivity and efficiency
  • Scalability
  • Streamlined development/DevOps cycles

Limitations of using Serverless Architecture

Like any other architecture, Serverless has its own limitations as well. Not all applications can be used with Serverless. It all depends on the use cases. A lot of applications might use 100% Serverless and many use Serverless for a part of their workflows like Storage, Notifications, and Image processing while the rest of the application runs in the traditional cloud infrastructure. The limitations of Serverless architecture are

  • Long-running application inefficiencies
  • Higher costs for stable or predictable workloads
  • Third-party dependency / Vendor lock-in
  • Cold starts

In this article, we saw what is FaaS and then we saw Serverless services that extend beyond FaaS. Then w have compared Serverless with BaaS, PaaS, and IaaS. We also saw the use cases for Serverless architecture, the benefits, and its limitations

Hope it was useful for you and thanks for reading!!!

I work as a freelance Architect at Ontoborn, who are experts in putting together a team needed for building your product. This article was originally published on my personal blog.