Often the term Serverless is used interchangeably with Functions as a Service. So, can we safely assume that these two terms mean the same thing?
Well, not really!!
Serverless is an approach. FaaS is a way to implement the Serverless approach.
Let’s begin this lesson with an understanding of what Serverless is.
What Is Serverless?
Serverless does not mean there are no servers involved when running the service. It simply means the servers have been abstracted away from the developers & they do not have to worry about them.
Serverless is an approach that enables the developers to focus on the code & not on the servers. Via this approach, the onus of the infrastructure administration on the developer is zero. That means there is no need for him to manage the server fleet, OS & so on.
Well, that’s the whole idea of cloud computing, isn’t it?
To take the responsibility of managing the infrastructure away from the developers as much as possible. The serverless approach provides the highest level of freedom from infrastructure management to the developers.
Also, Serverless being a relatively new approach has no standard definition. A general idea is if you are heavily using managed services for your application like DBaaS (Database as a Service), Messaging as a Service & so on. You just want to focus on creating value, that is, writing the business logic & limiting your exposure to the infrastructure. You have a serverless architecture.
As I stated earlier FaaS is a way to implement the Serverless approach. We can have a non-Serverless approach using FaaS too. That would be making the developer responsible for running his functions, monitoring & maintaining them, making them talk with other backend services, provisioning the servers & so on. So, this clears the fact that the FaaS is not Serverless, it’s a way to implement Serverless.
Ways To Implement The Serverless Approach
There are primarily two ways using which cloud providers enable the businesses to go serverless:
- Using BaaS - Backend as a Service
- Using FaaS - Function as a Service
We’ve already discussed FaaS, let’s have a quick insight into the BaaS service model.
Backend as a Service
Backend as a Service as the name implies is an entire backend available to the developers as a managed service. The idea is to enable the developer to focus on the business logic and let the platform take care of the rest.
A few examples of this are Google Firebase & AWS Amplify. These products are backend services for mobile apps also known as MBaaS (Mobile Backend as a Service).
Mobile Backend as a Service
Besides business logic and the user interface, a mobile app-based service contains several other key features that collectively make the service functional, top-notch, and worthy of getting the user’s attention. These features are user authentication, integration with social networks, push-notifications, real-time database, caching, data storage, messaging, chat integration, integration of third-party tools, analytics, crash reporting and so on.
Illustration 1.15 - Mobile Backend as a Service
MBaaS (Mobile Backend as a Service) takes care of all these features making a developer’s life a lot easier during the bootstrapping phase. It typically offers an API for every feature. There will be an API for user authentication, an API for real-time database, an API for messaging and so on. Our code can directly interact with the respective API and exchange information.
MBaaS is great for mobile-only services, great for use cases where you do not need or you don’t already have a custom backend, up and running for your service. In the case of an MBaaS, all the business logic resides on the client, which is the mobile app. The app is a Fat client.
We can also use MBaaS & a custom backend set up in the same app in scenarios where we are required to integrate a legacy enterprise system with our mobile app or when we need to leverage some additional features that the custom backend server hosts. Think of a banking app built using an MBaaS that needs to interact with the legacy enterprise backend to cross verify the data entered by the user every time.
Illustration 1.16 - MBaaS & A Custom Backend
In the next few lessons, we will have a look at a few cloud computing jargons such as the cloud workload, instance & so on. You might have already come across these terms in the lessons we’ve covered till now. And these will continue to appear over and over throughout the course.