Talk about the concept of distributed

Talk about the concept of distributed

Microservice

  The microservice architecture is divided into cells, just like a single application is developed as a set of small services, each small service runs in its own process, and uses a lightweight mechanism to communicate, usually HTTP API. These services are based on business capabilities. Build and deploy independently through a fully automated deployment mechanism. These services are written in different programming languages, as well as different data storage technologies, and maintain a minimum of centralized management.

  In short: Reject large monolithic applications, split micro-services based on business boundaries, and deploy and run each service independently.

 

Cluster & Distributed & Node

  Cluster is a physical form, and distributed is a way of working

  As long as it is a bunch of machines, it can be called a cluster. Whether they are writing and working together, no one knows;

<<Distributed System Principles and Generics>> Definition:

  "A distributed system is a collection of several independent computers, which appear to users as a single related system"

Distributed refers to the distribution of different businesses in different places

A cluster is to gather several servers together to achieve a unified business

For example: JD.com is a distributed system. Many businesses run on different servers. All businesses form a large business cluster. For each small business, such as a user system, it is not enough to fit one server under access pressure. We should deploy the user system on multiple servers, that is, each business system can also be clustered;

Every node that is distributed can be used as a cluster, and the cluster is not necessarily distributed.

Node: a server in the cluster

Remote call

  In a distributed system, each service may be on a different host, but it is inevitable that services need to call each other, which we call remote calls.

Use HTTP+JSON in Spring Cloud to complete remote calls

Load balancing

  In a distributed system, service A needs to call service B. Service B exists on multiple machines, and A can call any server to complete the function.

  In order to prevent each server from being too busy or too idle, we can call each server in a load-balanced manner to improve the robustness of the website.

  Common load balancing algorithms:

  polling:

     Select the first back-end server for the first request, and then select one by one in the order of installation, until the last one, and then loop.

 Minimal connection:
    Priority is given to the backend server with the least number of connections, that is, the backend server with the least pressure. This method can be considered in the case of a long session

Service Registration/Discovery/Registration Center

A service calls B service, A service does not know which servers B service currently has, which are normal, and which services have been offline. To solve this problem, you can introduce a registry;

If some services go offline, the rest of us can perceive the status of other services in real time, thereby avoiding the unavailable state of the service.

Configuration Center

Each service ultimately requires a large number of configurations, and each service bucket may be deployed on the opposite machine. We often need to change the configuration, we can let each service get its own position in the configuration center

The configuration center is used to centrally manage the configuration information of microservices

Service fusing & service degradation

In the microservice architecture, microservices communicate through the network, and there is mutual dependence. When one of the services is unavailable, it may cause an avalanche effect. To prevent this from happening, we must have a fault-tolerant mechanism to protect our services. . 

Service circuit breaker and service downgrade came out

Service fusing:

  Set the service timeout. When the called service often fails to reach a certain threshold, we can turn on the circuit break protection mechanism, and subsequent requests will not call this service. The local directly returns the default data

Service degradation

  During the operation and maintenance period, when the system is at its peak and the system resources are tight, we can degrade the operation of non-core services. Downgrade: silent writing service does not process, or simply handle [throw exception, return NULL, call MOCK data, call Fallback processing logic] .

API gateway

 In the microservice architecture, API Gateway, as the Zhang Yao component of the overall architecture, abstracts the public functions required by microservices, while providing client load balancing, automatic service fuse, grayscale release, unified authentication, and current limiting. Rich functions such as control, log statistics, etc., help us solve many API management problems.

 

 

 

 

Guess you like

Origin blog.csdn.net/weixin_45442617/article/details/110567139
Recommended