Table of Contents
Today cloud services, including Software as a Service (SaaS), Platform as a Service (PaaS), and Infrastructure as a Service (IaaS) are widely used as they provide on-demand delivery of services and resources for all types of software. They are scalable, flexible and cost-effective. Cloud computing is evolving swiftly and serverless architecture is its new execution model. While in traditional applications, server is always considered, in serverless architecture it is the code. This is also described as Function as a Service (FaaS).
It is actually not “server-less” literally, but instead of running a single large application in a cloud or a dedicated server, it is split into multiple independent isolated event driven micro-services or functions. Developers can write each module or micro-services in a different language and can host them in different clouds.
A well-planned serverless architecture can make the maintenance or future updates of the software easier.
In traditional architecture, the application is divided into several modules in different layers. Each module has specific business functions. It can also interact with other external services. All calls to external services are through the application, making it act as the entry and exit point for all interactions.
In serverless architecture, the application is split into several small functions called micro-services. Depending on the load the application is scaled automatically. The client application consumes different micro-services or functions that are hosted on diverse platforms, languages, locations. The functions are loaded only when they are required or being requested, thus making booting light-weight and quick. Each function is executed by a trigger that can be an event or the culmination of another trigger. These functions can be services hosted in a cloud or functions provided by third party providers, using the user register process. Serverless architecture, in fact, largely depends on third party service providers.
Let us suppose a user is filling a form and uploading an image. Actions like uploading image to cloud storage and saving information to database are handled by the server application.
Depending on the client device, the size of the image might vary. For example, an image uploaded from a mobile device might be larger in size compared to an image uploaded from a PC. These images must hence be optimized before saving as a file. In serverless architecture, the process is split into multiple functions. When a user submits the form, the server will trigger an event function which will upload the image to the cloud storage. This is followed by another event to save data to the database. Finally, the function to send a confirmation Email is triggered.
Pros:
Cons:
To sum it all up, serverless architecture helps developers achieve faster development and deployment of software and eliminates the need for dedicated and high capacity servers. Though serverless architecture comes with many advantages, it is advised to consider all the aspects holistically before taking the plunge.
Few giants offering cloud-based serverless services are Amazon Web Services Lambda, Microsoft Azure Functions, Google Cloud Functions and Docker.