INTRODUCTION

We are learning what is microservices and which are their components. And how those components help to build microservices structure. So we are going each component in detail as below.


What is Microservices ?

Developers can create several components of the same application in modules thanks to a software architecture type called microservices. Applications that use microservices provide decentralized data ownership so that each service has its own database.

Each module makes use of an API to interact with the database of various services. Each component can be deployed and updated by developers without affecting other areas of the application. 


Benefits of microservices architecture.

1) Scalable.
2) Highly Available.
3) Independent Deployment.
4) Faster deployment.
5) Improve Data Security.

Which are microservice components ?

1) circuit breaker 
2) API Gateway
3) Load Balancer
4) Service Discovery
5) Service Registry
6) Service Monitoring.
7) Service Orchestration.
8) Configuration Server.

Lets understand working and use of each component below,

1) Circuit Breaker : 

In microservices, a service or application makes several remote calls to other services' apps that are often operating on various servers throughout a network. Numerous calls to an unresponsive service might cause you to run out of vital resources, which can cause cascade failures across several systems.

Take into consideration the scenario when several users attempt to log into a banking application while the account service is offline. Numerous user threads are now waiting for a response from the account service while the authentication service waits for it, using up all of their CPU resources. As a result, no user can be served by the system.

It can avoid cascade failures from happening if a failed service is continuously contacted by other services, as well as it can assist manage and handle errors more.


Advantages of circuit breaker pattern 

1) prevents failures from cascading.

2) kindly handles mistakes and offers a better user experience.

3) decreases application recurrent downtime.

4) appropriate for managing asynchronous communications.

5) For error monitoring, the circuit breaker's state changes can be employed.

2) API Gateway : 

If you wish to design and develop complicated, massive microservices-based solutions with several client apps, the API gateway paradigm is advised. Although it is a component of a distributed system reverse proxy or gateway routing and is used as a synchronous communication model, the pattern is comparable to the façade pattern from object-oriented design. For the client applications, an API gateway offers a single endpoint, and it internally routes the requests to internal microservices.

As a result, many client apps are connected to this API Gateway. We should be cautious in this circumstance because if we employ a single API Gateway, there is a possibility of a single point of failure. It would go against the grain if these client apps became more complicated or added additional business logic to API Gateway.

Advantages of API gateway :

1) Centralized Access Point.

2) Security and Authentication.

3) Error Handling and Logging.


3) Load Balancer : 

Sharing incoming network traffic in real-time or on demand across servers in a server farm or server pool is known as load balancing. This sharing procedure may be carried out uniformly or in accordance with predetermined guidelines. Round Robin, Least Connections, and other rules.

There are two types of load balancing in a microservices architecture: client-side load balancing and server-side load balancing.

4) Service Discovery : 

Service Discovery can automatically find a network, eliminating the need for a time-consuming configuration setup process. In order for devices or services to connect to one another on the network without the need for manual intervention, service discovery relies on devices communicating using a common language. (For example, service discovery in Kubernetes and AWS)

Server-side and client-side service discovery are the two different kinds. Through a router or load balancer, client applications can find services thanks to server-side service discovery. By browsing or querying a service registry, which contains all service instances and endpoints, client-side service discovery enables clients apps to find services.
Due to the decentralized nature of a microservices architecture, service discovery is essential.

5) Service Registry : 

A service registry is a centralized database or directory that keeps track of data about the services that are accessible within a dispersed system or network. It is a crucial part of service discovery, facilitating efficient service discovery and service-to-service communication. Different services can more easily locate one another without relying on hard-coded configurations thanks to the service registry, which stores metadata and endpoint details for each.


Benefits of Service Registry : 

1) Dynamic Service Discovery.

2) Decoupling.

3) Load Balancing.

4) Cross Platform compatibility.


6) Service Monitoring : 

The technique of observing, gathering, analyzing, and managing the health, performance, and behavior of each individual microservice as well as the system as a whole is referred to as service monitoring in the context of microservices. Maintaining the dependability, availability, and performance of microservices-based applications requires careful monitoring. In order to understand how services are operating and to swiftly identify and address problems, it includes utilizing a variety of tools and procedures.

Advantages of Service Monitoring

1) Early issue detection

2) Faster Problem Solving

3) Performance Optimization.

4) Continuous planning.


7) Service Orchestration : 

Microservices orchestration is a centralized method in which the orchestrator, a central component, is in charge of directing and orchestrating communication between the microservices. Multiple services are coordinated to cooperate in a set way to complete specific business processes or activities, which is an important idea in distributed systems and microservices architecture. Numerous advantages of service orchestration increase an application's effectiveness, maintainability, and adaptability.

Advantages of Service Orchestration :

1) Centralized control

2) Complex Workflow management.

3) Error Handling.


8) Configuration Server :  

In modern software architectures, especially in microservices and cloud-native applications, a configuration server—also known as a configuration management server or a configuration service—is a crucial element. Its main responsibility is to administer and distribute configuration options and parameters for different system services and applications. In a dispersed context, this centralized method of maintaining configuration information aids in ensuring consistency, security, and effectiveness.

Benefits of Configuration Server.

1) Security and access control.

2) Dynamic Environment Management.


CONCLUSION : 

So we have learned key components of microservices. Some of components we will learn in detail.