Building server-less micro-services application — a small walkthrough!

Prologue

So, your cloud enterprise software is siloed into loosely coupled smaller pieces and then, run as a collection of smaller parts instead of one monolithic whole. Good Job! Basically, you have adopted the microservices architecture, where each piece of your application performs a smaller set of services and runs independently of the other part of the application and operates in its own environment and stores its own data. But, then you have multiple servers on the cloud to take care of and multiple databases to manage. So here comes the problem:

The Problem

So, you have rented the fixed units of server space from your cloud provider, generally over-purchase to ensure that a spike in traffic or activity wouldn’t exceed your monthly limits and break your microservices.

Then, the accounts department comes in, asking an explanation of the cloud provider’s expense report.

Also, as you add more services and glue them together, you start worrying about their scalability. You try to realize the scaling on demand, which your cloud provider promised but you are then, stuck into writing scaling policies in some archaic language that your cloud vendor supports or learning a completely new language paradigm that a framework promises to support for your cloud vendor.

The Solution

Enter the serverless paradigm, where you are charged based on the computation and do not have to reserve and pay for a fixed amount of bandwidth or number of servers, as the service is auto-scaling. You then, write your services as functions, FaaS and stop worrying about managing your resources and autoscaling.

Another benefit that comes out of the box is the software developer does not have to worry about multithreading or directly handling HTTP requests in their code, simplifying the task of back-end software development.

Next, you pick up the serverless database as you have to deploy multiple databases in the backend, not all databases need to be live and should automatically start up, shut down, and scale capacity up or down based on the service’s needs.

And finally, you pay as you go! The accounts team is happy, you are happy and everyone is happy!

The Realization

Serverless Microservices application can be realized end-to-end as let’s say on AWS :

Epilogue

So, you have divided the monolithic applications into microservices, all integrated by loose coupling into separate micro-applications. Now is the time to convert these microservices into serverless functions as a service and then, deploy them in a serverless architecture. You should even, break the frontend into micro-frontends and serve them separately to make it complete micro-application. Refer my previous article on micro-frontends for such micro-services based backend to make a complete micro-application based architechture.

Solve the problem once, use the solution everywhere!


Serverless Microservices was originally published in Technopreneurial Treatises on Medium, where people are continuing the conversation by highlighting and responding to this story.