Microservices
Microservice Architecture is a Service Oriented Architecture.
The microservice defines an approach to the architecture that divides an application into a pool of loosely coupled services that implements business requirements.
The most important feature of the microservice-based architecture is that it can perform continuous delivery of a large and complex application.
Microservice helps in breaking the application and build a logically independent smaller application.
Principles of Microservices
There are the following principles of Microservices:
1) Single Responsibility principle
2) Modelled around business domain
3) Isolate Failure
4) Infrastructure automation
5) Deploy independently
Microservices Monitoring Tool
There are three monitoring tools are as follows:
1) Hystrix dashboard
2) Eureka admin dashboard
3) Spring boot admin dashboard
Components of Microservices
There are the following components of microservices:
Spring Cloud Config Server
Netflix Eureka Naming Server
Hystrix Server
Netflix ZuulAPI Gateway Server
Netflix Ribbon
Zipkin Distributed Tracing Server
Spring Cloud Config Server (port - 8888)
Spring Cloud Config Server provides the HTTP resource-based API for external configuration in the distributed system.
We can enable the Spring Cloud Config Server by using the annotation @EnableConfigServer.
spring.cloud.config.uri=http://localhost:8888
spring .profile.active=dev
Netflix Eureka Naming Server (port - 8761)
Netflix Eureka Server is a discovery server.
It provides the REST interface to the outside for communicating with it.
A microservice after coming up, register itself as a discovery client.
The Eureka server also has another software module called Eureka Client.
Eureka client interacts with the Eureka server for service discovery.
The Eureka client also balances the client requests.
Hystrix Server
Hystrix server acts as a fault-tolerance robust system.
It is used to avoid complete failure of an application.
It does this by using the Circuit Breaker mechanism.
If there is an error encountered in the application, the Hystrix Server opens the circuit.
The Hystrix server stops the further request to calling service.
Netflix Zuul API Gateway Server (port - 8765)
Netflix Zuul Server is a gateway server from where all the client request has passed through.
It acts as a unified interface to a client.
It also has an inbuilt load balancer to load the balance of all incoming request from the client.
SOLID Principles Java
SOLID principles are an object-oriented approach
It is conceptualized by Robert C. Martin (also known as Uncle Bob)
- Single Responsibility Principle (SRP) - every Java class must perform a single functionality
- Open-Closed Principle (OCP) - the module should be open for extension but closed for modification.
- Liskov Substitution Principle (LSP) - derived classes must be completely substitutable for their base classes.
- Interface Segregation Principle (ISP) - the larger interfaces split into smaller ones.
- Dependency Inversion Principle (DIP) - use abstraction (abstract classes and interfaces) instead of concrete implementations.
Load Balancer
HLB - Hardware Load Balancer
L4 & L7 (Transport Layer & Application Layer)
F5 Hardware
UDP, TCP, SCTP
HTTP, HTTPS, SMTP, IMAP, FTP, DNS, NNTP
SLB - Software Load Balancer
L7 (Application Layer)
NGINX
HTTP, HTTPS, SMTP, IMAP, FTP, DNS, NNTP
API Gateway
Service Registry
Service Discovery
Layers Model
The OSI Reference Model:
Application - Layer 7 (HTTP URL, Path, Params)
Presentation - Layer 6
Session Layer - Layer 5
Transport - Layer 4 (IP, Port, Protocol, TLS)(Load Balancer)
Network Layer - Layer 3
Data Link Layer - Layer 2
Physical Layer - Layer 1
^|^|^|^|^|^|^|^|^|^|^
Physical Medium
Comments
Post a Comment