Skip to main content

Monlith Vs Microservices

Application can be developed in 2 ways.

1) Monolith Architecture
2) Microservices Architecture

-> If we develop all the functionalities in one single application then it is called as Monolith Application.

Advantages
++++++++
1) Development is easy
2) Deployment is easy
3) Performance
4) Easy Testing
5) Easy Debugging
6) KT is easy

Dis-Advantages
+++++++++++
1) Single point of failure
2) Whole Application Re-Deployment
3) Scalability ( Increasing & Decreasing resources based on demand )
4) Reliability (Strong)
5) Availability (Zero Downtime)

=> If we develop the functionalities in multiple services/apis then it is called as Microservices Architecture Based Application.

=> Every Microservice will have its own goal.

Advantages
++++++++
1) Loosely coupled
2) Fast Development
3) Quick Releases
4) Flexibility
5) Scalability
6) No Single Point of failure
7) Technology independence

Challenges
+++++++
1) Bounded context (identifying no.of services to develop)
2) Lot of configurations
3) Visibility
4) Testing is difficult
5) Debugging

Microservices Architecture
#####################
-> Microservices is an architectural design pattern to develop our applications.
-> There is no fixed architecture for Microservices Based Applications.
-> People are customizing Microservices Architecture according to their requirement.

*********** Let us see generalized architecture of Microservices ***************

1) Service Registry
2) Admin Server
3) Zipkin Server
4)  Services (REST APIs)
5) FeignClient
6) API Gateway




-> Service Registry is used to register all our backend services/apis.
-> Service Registry will maintain services names, urls and status of each service.
-> We can use Eureka Server as a service registry.

Note: EurekaServer provided by Spring Cloud Netflix Library.

-> AdminServer is used to monitor and manage all our backend services at one place.
-> AdminServer will provide user interface to monitor and manage our services.
-> Using AdminServer user interface we can access Actuator Endpoints of our services at one place.

Note: AdminServer and Admin Client provided by 'Code Centric' company (we can integrate with boot)

-> ZipkinServer is used for Distributed Log Tracing.
-> ZipkinServer will provide user interface to monitor application execution details.
-> How many services involved and which service took more time to process the request can be monitored using Zipkin.

Note: Zipkin is third party open source server (can be integrated with spring boot)

-> Backend services are nothing but REST APIs (which are also called as Microservices)
-> Backend REST APIs contains actual business logic of our application.
-> One project will have multiple REST APIs in the backend.
-> Each Backend api will act as client for Service Registry + Admin Server + Zipkin Server.

-> With in the same application If one backend api communicating with another backend api  then it is called as Interservice communication.
-> FeignClient will be used to perform Interservice Communication.

Note: Based on requirement our backend apis can communicate with 3rd party apis using RestTemplate or WebClient

-> Api Gateway will act as an Entry point for our backend apis
-> It acts as mediator between endusers and backend apis
-> API Gateway contains Filters and Routing
-> Filters we can use to authenticate incoming requests
-> Routing will decide which request should go to which backend api

Note: In previous versions we have Zuul Proxy as API Gateway but now it got removed from latest version of boot

-> Spring Cloud Gateway we can use as API Gateway for our application.

Load Balancing
############
-> If we run our application on Single Server then all requests will be sent to single server.
-> Burden will be increased on the server.
-> When burden got increased request processing gets delayed.
-> Sometimes our server might crash due to heavy load.

To overcome above problems we will use Load Balancing concept 
*****************
-> Load Balancing is the process of distributing load to multiple servers.





Comments

© 2020 The JavaDS Hub

Designed by Open Themes & Nahuatl.mx.