当前位置:网站首页>Nacos - service discovery
Nacos - service discovery
2022-07-01 08:40:00 【SXHENIGA】
Translation source of notes : Dark horse Nacos
One 、 Monomer architecture and microservices
1、 Monomer architecture
Use the same database for all functional modules , meanwhile , It also provides API perhaps UI Access to the Web Module etc. , Eventually, it will be packaged and deployed as a single application , This method deploys all functions in one Web The system running in the container is called monomer architecture
| advantage | |
| 1 | High development efficiency |
| 2 | Easy to test |
| 3 | Easy to deploy |
| shortcoming | |
| 1 | The complexity is getting higher , The maintainability of the giant sword is getting worse |
| 2 | The falling speed of the version gradually slows down |
| 3 | Hinder technological innovation |
| 4 | Can't scale on demand |
2、 Microservices
Each business module uses independent services to complete , This microservice architecture pattern also affects the relationship between applications and databases , Unlike traditional methods, multiple business modules share a database , Microservice architecture each service has its own database .
| benefits | |
| 1 | Divide and rule , Single responsibility ; Easy to develop 、 Understanding and maintenance 、 Facilitate the splitting and management of the team ; |
| 2 | Telescopic ; It can scale the specified service separately ; |
| 3 | Local modification , Easy to replace , Easy to deploy , Conducive to continuous integration and rapid iteration |
| 4 | Not limited to any technology stack |
Two 、 Service discovery
In microservices , Services collaborate to achieve business goals . Remote calls between services are also required in microservices , Then you need to know the network location of the service 【IP And port number 】, Then you need to achieve the following .
①、 You need to report your network location to the service discovery center when each service is started .
②、 The service discovery client will periodically synchronize the service registry from the service discovery center , And cache on the client
③、 When a service needs to be requested , The service instance passes through the registry , Locate the target service network address . If the target service has multiple network addresses , Then the load balancing algorithm is used to select one from multiple service instances , Then make a request .
summary : In microservice , Because the network address of the service running instance is constantly changing , Dynamic changes in the number of service instances , Therefore, a fixed configuration file cannot be used to record the provider's network address , Dynamic service discovery mechanism must be used to realize mutual perception between microservices . Each service instance will report its own network address , In this way, the service center forms a complete service registry , Each service instance will obtain the network address of the target service through the service discovery center , So as to realize the mechanism of service discovery .

3、 ... and 、 Comparison between mainstream service discovery and configuration center
| Comparison items | Nacos | Eureka | Consul | Zookeeper |
| Agreement of conformity | Support AP and CP Model | AP Model | CP Model | CP Model |
| health examination | TCP/HTTP/MYSQL/Client Beat | Client Beat | TCP/HTTP/gRPC/Cmd | Keep Alive |
| Load balancing strategy | The weight /metadata/Selector | Ribbon | Fabil | - |
| Avalanche protection | Yes | Yes | nothing | nothing |
| Auto logout instance | Support | Support | I won't support it | Support |
| access protocol | HTTP/DNS | HTTP | HTTP/DNS | TCP |
| Monitor support | Support | Support | Support | Support |
| Multi-data center | Support | Support | Support | I won't support it |
| Sync across registries | Support | I won't support it | Support | I won't support it |
| SpringCloud Integrate | Support | Support | Support | I won't support it |
| Dubbo Integrate | Support | I won't support it | I won't support it | Support |
| k8s Integrate | Support | I won't support it | Support | I won't support it |
Four 、Spring Cloud Service collaboration process

边栏推荐
- 2022 ordinary scaffolder (special type of construction work) examination question bank and the latest analysis of ordinary scaffolder (special type of construction work)
- I would like to know the process of stock registration and account opening by mobile phone? In addition, is it safe to open a mobile account?
- Yolov5 advanced six target tracking environment construction
- Vscode customize the color of each area
- 为什么LTD独立站就是Web3.0网站!
- [untitled]
- AES简单介绍
- 截图小妙招
- It is designed with high bandwidth, which is almost processed into an open circuit?
- Brief introduction to AES
猜你喜欢

SPL installation and basic use (II)
![Matlab [function derivation]](/img/ba/9fb9da8a458d0c74b29b21a17328fc.png)
Matlab [function derivation]

Glitch free clock switching technology

Intelligent water and fertilizer integrated control system

MATLAB【函数和图像】

Mavros sends a custom topic message to Px4
V79.01 Hongmeng kernel source code analysis (user mode locking) | how to use the fast lock futex (Part 1) | hundreds of blogs analyze the openharmony source code

截图小妙招

What is 1cr0.5mo (H) material? 1cr0.5mo (H) tensile yield strength

【MFC开发(17)】高级列表控件List Control
随机推荐
Intelligent water conservancy solution
2022 examination summary of quality controller civil engineering direction post skills (quality controller) and reexamination examination of quality controller civil engineering direction post skills
明明设计的是高带宽,差点加工成开路?
Mavros sends a custom topic message to Px4
AES简单介绍
MAVROS发送自定义话题消息给PX4
Luogu p3799 demon dream stick
MATLAB小技巧(23)矩阵分析--模拟退火
Matlab [function derivation]
Redis源码学习(29),压缩列表学习,ziplist.c(二)
Internet of things technology is widely used to promote intelligent water automation management
中考体育项目满分标准(深圳、安徽、湖北)
Maneuvering target tracking -- current statistical model (CS model) extended Kalman filter / unscented Kalman filter matlab implementation
避免按钮重复点击的小工具bimianchongfu.queren()
Advanced C language pointer (Part 2)
Memory size end
Introduction to R language
分享2022上半年我读过的7本书
用C语言编程:用公式计算:e≈1+1/1!+1/2! …+1/n!,精度为10-6
factory type_id::create过程解析