当前位置:网站首页>Advantages of micro service registry Nacos over Eureka
Advantages of micro service registry Nacos over Eureka
2022-06-23 22:17:00 【FHAdmin】
Why use a registry
Have used ip:port Development experience of address direct call service ? The painful experience is omitted here 500 word ......, The disadvantages of this method :
- You need to manually maintain all service access ip Address list .
- A single service needs to be built by itself to achieve load balancing , For example, using nginx Load balancing strategy , Or deploy a single service based on containerized multiple instances , Load balancing between instances .
- Service providers : Provide service access to the registry based on the service name ip:port And other information .
- Registry Center : According to service name , Store the corresponding ip:port And other information .
- Serving consumers : Obtain the name of the calling service from the registry according to the service name ip:port And other relevant information sets , Then get the final server according to the load balancing policy ip:port Access address .
Use springcloud when , What is commonly used is eureka and nacos As a registry , How to choose ?(nacos eureka Project case fhadmin.cn)
Service providers
Actively register with the registry , The contract , Offline , Get registry . After successful service registration , Send heartbeat to the registry regularly , Ensure that the service is not eliminated .
Registry Center
Storage service instance , Scan the registry regularly , Eliminate expired service instances . High availability through synchronous replication , Get the registry first , Then register yourself with other registries , Belong to AP Pattern . In the actual project , According to the environment , for example dev,test,prod Configure different registry clusters , If different projects use a unified registry , It can only be distinguished by service name .
Let's focus on Eureka Self-protection mechanism . If a large number of service instances expire, they will be rejected , Then the registry enters self-protection mode , The information in the registry is no longer deleted , The aim is to improve eureka The usability of . By default , The failure rate of heartbeat is calculated at 15 Is it less than in minutes 85%, If lower 85%,Eureka Server These instances will be protected , Keep these instances from expiring .
Tell me about a painful online experience , The error is described as follows :
At that time, the service deployment was successful , stay Eureka The registry has shown that the service has been registered successfully , however , When the front-end request is forwarded to the service through the gateway , There has been no response , The service call has been unsuccessful .nginx forward , Gateway forwarding is confirming where the problem is , After many torments , Directly through the gateway ip The address is forwarded to the online service , Quickly solve the problem . follow-up , replay , should Eureka Self-protection mechanism , Resulting problems . The service registered in the registry is an unavailable service , however , Due to the self-protection mechanism ,Eureka Server Invalid services are not eliminated .
The subsequent solution is , Set up enableSelfPreservation=false Turn off self-protection , hold renewalPercentThreshold Proportion reduction , stay Eureka Server End , If there is an invalid service, the service will be rejected .
nacos Registry Center
nacos yes springcloud An extension of , The registry function is through NacosDiscoveryClient Inherit DiscoveryClient, stay springcloud in , And Eureka It can switch without intrusion . The registry can manually remove service instances , Notify the client to update the cached instance information through a message
nacos The key point is to understand its domain model Nacos Data model Key Uniquely determined by triples , Namespace Namespace , grouping group,service service . Please refer to the official website for details Nacos framework .
nacos And Eureka The comparative advantages are as follows :
- nacos In automatic or manual offline service , Use the message mechanism to notify the client , Changes to service instances respond quickly ;Eureka Invalid services can only be eliminated through task timing .
- nacos According to namespace Namespace ,DataId,Group grouping , To distinguish between different environments (dev,test,prod), Configuration of different projects .
边栏推荐
- In the "Internet +" era, how can the traditional wholesale industry restructure its business model?
- v-chart
- [open source]goravel, a fully functional and extensible golang web application framework
- ICML2022 | 基于对比学习的离线元强化学习的鲁棒任务表示
- MySQL de duplication query only keeps one latest record
- CMU doctoral thesis | meta reinforcement learning through memory, 118 Pages pdf
- Detailed explanation of logical structure, physical structure and data operation
- 2008R2 CFS with NFS protocol
- Detailed explanation of lkadoc interface tool
- Question: how to understand the network protocol and why the OSI reference model is divided into seven layers
猜你喜欢

北大、加州伯克利大学等联合| Domain-Adaptive Text Classification with Structured Knowledge from Unlabeled Data(基于未标记数据的结构化知识的领域自适应文本分类)

使用 Provider 改造屎一样的代码,代码量降低了2/3!

北大、加州伯克利大學等聯合| Domain-Adaptive Text Classification with Structured Knowledge from Unlabeled Data(基於未標記數據的結構化知識的領域自適應文本分類)

The latest research progress of domain generalization from CVPR 2022

Analysis of Alibaba cloud Tianchi competition -- prediction of o2o coupon

CAD图在线Web测量工具代码实现(测量距离、面积、角度等)

Ten thousand words! Understand the inheritedwidget local refresh mechanism

万字长文!一文搞懂InheritedWidget 局部刷新机制

Code implementation of CAD drawing online web measurement tool (measuring distance, area, angle, etc.)

How to improve the content quality of short video, these four elements must be achieved
随机推荐
In depth understanding of Internet of things device access layer
Smart cockpit SOC competition upgraded, and domestic 7Nm chips ushered in an important breakthrough
How does the fortress machine view the account assigned by the server? What are the specific steps?
Performance optimization of database 5- database, table and data migration
How to deploy API gateways and split services under multi services?
What do you know about the 15 entry-level applets
[emergency] log4j has released a new version of 2.17.0. Only by thoroughly understanding the cause of the vulnerability can we respond to changes with the same method
The 10th Blue Bridge Cup single chip microcomputer
How do API gateways set up dynamic routing? What are the benefits of dynamic routing?
EDI mandatory manual
Dart series: smooth as silk, operating files and directories
How to configure Nessus vulnerability scanning policy?
How to transfer files from the local fortress server
University of North China, Berkeley University of California, etc. | Domain Adaptive Text Classification with structural Knowledge from unlabeled data
Benchclock: a benchmark for evaluating semantic analysis language models
Configuring error sets using MySQL for Ubuntu 20.04.4 LTS
How to batch generate video QR code
Take you through the distributed file system
In the "Internet +" era, how can the traditional wholesale industry restructure its business model?
How do fortress computers log in to the server? What is the role of the fortress machine?