The serverless approach to application development

In recent years, as developers, we have grown accustomed to the traditional ways of building applications and handling their deployments on the production infrastructure. In this traditional architecture, we developed applications where the application takes in a request from the Client, checks whether the Client is authorized to perform that action, and then moves on to executing that action.

Once the application was developed, we deployed it over a platform that would be compatible with our application. This involves the choice of the operating system, the kind of the infrastructure where this platform will be running, for example a bare-metal server, a VM, or a container, and then we maintained the infrastructure by handling its scalability and fixing any issues that may arise. For example, a simple system that manages employee payroll inside an organization will look like this:

In this case, the application keeps running on a server, waiting for the requests to come, and acting on them as they arrive.

This kind of approach, though highly useful, usually pulls the developers from their main task of writing the logic to achieve a particular outcome from the system, and makes them focus on a lot of areas that involve tasks related to the infrastructure management and scalability.

Now imagine an architecture that would allow developers to focus on just writing the logic behind a particular business process without worrying about where that logic will be executed and how it will scale.

The serverless approach to building applications provides these features. The way this works in serverless is through the introduction of two new techniques to application development:

  • Backend as a service (BaaS): BaaS is a new cloud computing offering that provides the application developers with the functionality of linking their applications with the backend services through the use of APIs, so as to provide some common feature sets, such as user authentication and data storage. It differs from the general architecture of application development in that these services provided by the backend may not need to be developed by the application developers themselves, but access to these services is enabled through the use of APIs exposed by these services.
  • Function as a service (FaaS): FaaS is another category of cloud computing that allows developers to focus on writing the application logic without worrying about where this logic will execute. In FaaS, the applications run in a stateless and ephemeral manner where the infrastructure they might be executing in may be valid only for a few invocations, which may be as little as a single invocation.

In the serverless architecture of application development, the applications are usually developed as functions that are executed as a response to a certain event. These functions execute in their own stateless containers, which may exist in the infrastructure for only a few invocations. We will take a look at how the serverless applications work in the later sections of this chapter. For a quick reference, if we had to implement the Payroll system as a serverless application; the following diagram shows how the architecture of the system would look:

As we can see, our serverless payroll application contains both the features of a BaaS offering where the Client directly interacts with the Auth DB through the APIs exposed by the Auth DB and the Payslip generation, and employee search runs in a FaaS offering where they are stored as functions and executed only when a particular event happens.

Both of these functions do not maintain any kind of state, such that they can run in ephemeral containers that may only last for a short amount of time.

So now, let's take a look at the components that power the serverless architecture and how the serverless architecture works to have a better understanding of how we can develop applications that best utilize the serverless architecture.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
52.14.82.217