Serverless Computing and Microservices are not exactly related unlike cloud computing and virtualization are related. It is of importantance not to confuse architecture and technologies but use the correct technology for the correct architecture. Microservices is a style of architecture style where we develop a set of multiple operation specific to a business logic. In that way, the total software becomes a loosely coupled services which can be independently evolved, released, and managed. They communicate to each other using Messaging Queues or REST APIs. Serverless often useful in autoscaling and load balancing to provide higher uptime.
There is a synergy between Serverless Computing and Microservices. Microservices break down the monolithic applications into loosely coupled services. Systems which have adopted the microservices architecture are already prepared to move to serverless computing. Serverless is a good environment to build a microservices architecture by optimal virtualization of the resources and reusing the APIs.
So, in case of a monolithic application, we are using the total dedicated server for running the web application. Virtualization and cloud computing helping us to divide the dedicated server in to multiple virtual servers which are ready run or shut-down without the need to work on the main dedicated server. Microservices are breaking down the monolithic application which would run on the dedicated server into “pieces”. Serverless computing platform like Apache OpenWhisk itself can run on few of the virtual servers. The Serverless computing platform can run some part of the application which the Microservices already chopped in to pieces. Even if we utilize one dedicated server, we can better utilize, manage the coding part of the application.
Microservices is a software development technique whereas Serverless computing is an approach of the cloud computing model. Microservice focuses on breaking down into more discrete services which provide an isolation from other components within the system. This, in-turn focus on code writing around some specific business domains. Now our above example of using a dedicated server will be meaningful – each kind of developers after deploying Microservices can independently manage and upgrade these discrete services. This was not possible with the monolithic application installed on whole dedicated server. However, the granularity of Microservices comes with some additional challenges, like to orchestrate all of these different calls. We do have API Gateways that provide some level of abstraction across these microservices. This offers us more agility as we can enable the service-call redirection without modifying the underlying services. As the monoliths are now diffused into individual services, it provides us better virtualization of resources. We can move some of these independent services to better position by moving to serverless.