After reading the previous two posts you all must be excited to implement microservice architecture to your application and that’s good you should be ready to implement something new that might boost the application performance, maintenance, scalability and will make your application future proof. But have you ever thought how will you be breaking your application into micro application i.e microservices. Think about it for some minute exercise your brain for some time before reading the below tutorial.
Now i am sure that you all might have come through excellent ideas for breaking up your application in microservices. Please feel free to mention your valuable ideas in comment so that other or even me can be benefited by your ideas.
Now before breaking your application into micro-services you should consider following points.
Points to be considered before creating microservices.
- Your each services should be easily testable.
- Your application should be Cohesive.
- Your application should be easily maintained by the help of small team(6-8 members).
- Each micro-services should be loosely coupled.
- Each team who are developing microservices should be self capable for end to end process from development to deployment.
Patterns to decompose your monolithic application into microservices
- Decompose on basis of business capability.
- Decompose on basis of subdomain.
Decomposition on basis of business
Whenever we develop microservices architecture we focus that our application is loosely coupled and support continuous delivery and development. Whenever changes come to our application it should impact only one service no multiple services as when the we have to deal with multiple services changes in order to comply with single change then we have to interact and depend on multiple team which will slow the process of development and cost productivity.
So when decomposing the application into microservices we can considers business capabilities. Business capability is something that business does to generate its value. We will take and example of school management system.
In School management system from where the scholl generates it value.
Then we can decompose our application on igh label into 3 services on which will deal with admission of the student, Students management, and Stationery.
Main problem with this structure is before decomposing one should have proper understating of business and its organisation for successful decomposition of the application.
Decomposition on basis of Subdomain
We can follow Domain-Driven Design(DDD) to apply this type of decomposition. In this Decomposition we have to define our domains in which our business will be working and also we have to identify the subdomain for each domain so that our each services will be small and easily manageable. We will take same example as we took above, of Student Management.
Here we can have domain as.
And further Admission can be decomposed into Accounts, Fees Management and etc
And Students can be decomposed into enrollment, Attendance and etc.
By this we will be having small modules or services which are easily manageable and maintainable.
In this blog we learn about ways to decompose our monolithic application into small, maintainable, scalable services which are loosely coupled and help in continuous delivery and deployment. We covered about Decomposition on basis of business and Decomposition on basis of subdomain.
Where in business decomposition we have to decompose our application by identifying the business capability which generates revenue for the business and in Subdomain decomposition we learned the way do decompose the application in domain by domain driven design and further decomposing the into subdomains.