What is a microservice?

A microservice is a small application designed to perform a specific business task well. Microservices are typically implemented as RESTful web services. The following are some of the characteristics of a microservice: 

  • Smaller in size (compared to monolithic applications), and focuses on a single business task/module
  • Has its own database, in contrast to a monolithic application that has one database for all business functionalities
  • Is typically a standalone application, with a web container bundled into it

A large business application can be built by assembling smaller microservices. Compared to a large monolithic application, a microservice architecture provides the following benefits:

  • They are easy to deploy. In a monolithic application, deployment can be quite cumbersome because of the complexity of the application. Microservices are small and can be easily deployed on servers.
  • Microservices are loosely coupled, so changes in one can be isolated from other services in an application. Also, having a separate database for each service can further insulate the main application and other services from changes made in the schema of the database.

To understand the contrast between monolithic application architecture and microservice architecture, let’s see an example. Throughout this book, we have been following the Course Management example. Let’s say this module is part of a larger University Management System, which has many more modules. A monolithic architecture for this application can be viewed as follows:

Figure 12.1: Monolithic application architecture

We have one large application, the University Management System, with multiple modules and a single database.

The same application can be architected using microservices as follows:

Figure 12.2: Microservice application architecture

In the microservice architecture, the University Management System is composed of many microservices, each with its own database.

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

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