Microservices Using Spring Boot and Spring Cloud
Let’s welcome another word “Microservices” on the crowded Street of Software. Let’s define microservice in a simple and best way. We will learn why industry is building Microservices using Spring Boot and Spring Cloud.
A Micro Service is a design pattern or an architectural pattern to develop complex applications into simple reusable components. A monolithic application is built as a single unit whereas a micro service application is built in several independent units and easily deploy-able.
Let’s explain this by an example of an e-commerce application .
In a traditional application, there are several domain components such as Account Component, User Component and Order Component which collaborates with each other and packaged in a single deployable war. That’s is the monolithic approach illustrated below.
Monolithic Application Approach :-
Micro services Architecture:-
In this above pattern we are deploying each components as a distributed and separated app. These different components can interact each other. So in order to build large applications , we need to identify the different sub domains under the domain and build each sub domain as a Micro Services.
Advantages Of Micro services
- Being independent deployable microservices app .Our components becomes loosely coupled.
- We can have multiple teams working together seamlessly.
- Code base becomes pretty much small.
- Maintaining release becomes easier.
Why to Build Microservices Using Spring Boot and Spring Cloud:-
Let me tell you in Short, Netflix (one of the most popular on-demand video streaming service ) is the place where it all started for microservices, they decoupled their applications and implemented the microservices architecture. Netflix realized that many of their innovations are useful and can be used for a variety of purposes, So they decided to open source these technologies.
The approach or the architecture followed by Netflix helped them to deliver software fast, solved issues of distributed computing and industry loved it. So industry started accepting this architecture.
We followed the same architecture and started developing software into a small set of independent modules. But While doing this we made code that is independently deployable which implies we are into the world of distributed applications. The pain is now managing these set of distributed applications, So Spring Cloud comes to the rescue.
Spring team was alert enough to discover that the Netflix OSS projects have addressed a number of key architectural problems about the Cloud environment. There was a need to improve consumer ability of the Netflix projects , hence they Started Spring Cloud and reinvented a lot of stuff.
Spring Cloud is a new Project
Spring.io familyand built on top of Spring Boot. Spring cloud solves a very basic need for cloud-based applications. These applications are distributed applications running in a distributed environment. Spring cloud is the result of an integration of libraries from Netflix and provides easy access to these Netflix libraries. Spring Cloud takes features and libraries from Netflix cloud components and integrates inside spring family in a well designed and easily consumable way.
Let’s have a look at few of the Spring Cloud Projects that we can leverage to solve distributed applications issues:-
- Spring Cloud Config Server.
- Spring Cloud NetFlix.
- Spring Cloud Bus
- Spring Cloud Service Broker.
- Spring Cloud Cluster.
We have designed a cloud architecture for our Micro-services Project . Each of these above components solves one or other challenge, So let’s check these by one in coming Series of the post. We are going to build few services and use the above Spring Cloud components. Stay tune !
Keep In Mind , do not unnecessarily overuse the micro services pattern in your applications . Please understand first what problems it solves then try and implement .