What is Microservice Architecture?

Look at this architecture below.

 

You have the Employees Module, Customer Module, Courses Module, and Address Module, but right now we will not tell them as modules rather we will tell them Services, small, small Services. The entire application has divided into four different small services like the employee is a separate service, the customer is a separate service, the course is a separate service, and the address is a separate service. Now we will create separate applications (for example 4 different Spring Boot applications) for these services. And these applications can talk to each other internally. So right now these are four different applications and they all have separate databases. We can say building out small, small services are called Microservices. So now that particular monolithic architecture changed to this.

 

We have our Employee Service/Application, the code goes to get Jenkins Build it and it pushed it to the server and this server has a separate database called the Employee database and the same goes for the other 3 modules. So here we have 4 different databases, and 4 different Servers for 4 different services/applications. You have five more modules same as well. So following are the advantages

  • Independently Deployable
  • Each app can be tested separately
  • Code changes in one application/service do need an entire application testing
  • Dev working on one service shouldn’t require the entire application knowledge

So these are some major advantages of using Microservices.



Why the World is Moving Towards Microservices Architecture?

Imagine you run an organization called XYZ and let’s say you have a requirement right now that you want to create an “Employee and Customer Management System“. And let’s say you have few people who purchase your services like your clients/customers. So they talk with you about the requirements and all. And in the organization, you have some employees also. So as per the requirements you want to create an application that is going to help you to manage your employees and customers. So we want to build an application that has the following basic functionalities.

  • Add employees/customers
  • Delete employees/customers
  • Update employees/customers

And you started developing the application. So in the beginning, you try to find out the main components. So the main components/modules for this requirement are 

  • Employees Module: To manage your employees
  • Customers Module: To manage your customers
  • Courses Module: In this module, you’ll be selling your courses, somebody will purchase your courses, etc.
  • Address Module: In this module, we will manage the employees’ and customers’ different types of addresses like billing addresses or shipping addresses, etc.

After that, you started designing endpoints like 

  • /employees, /employees/id
  • /customers, /customers/id
  • /courses, /courses/id
  • /address, /address/id, etc.

Please refer to the below image.

 

So now you have different modules and imagine you have developed all these endpoints and you have created the Employee Controller, Customer Controller, Course Controller, Address Controller created all these endpoints which are specific to those controllers and you just wrapped it off under this .ZIP file and you put it on a server let’s say on a tomcat server or JBoss server and you deployed the war file. And you’ll have your database as well which is going to be connected and all your employee table, customer table, course table, and address table will be over here on the database. So this type of architecture, we can say a Monolithic Architecture. Why so? Because we are wrapping all our components modules under a single zip and we are deploying it into the server this is the traditional approach which is pretty much familiar in 2000 but right now the requirements are changing and you’re going to be getting a lot of different types of requirements. So this is something that we call Monolithic Architecture.

 

So now what are the problems and challenges that we basically face on monolithic and why the world is moving towards microservices?

Similar Reads

Problems/Challenges with Monolithic Architecture or Why Microservice Architecture?

Problems/Challenges 1:...

What is Microservice Architecture?

Look at this architecture below....