当前位置:网站首页>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 .
边栏推荐
- BenchCLAMP:评估语义分析语言模型的基准
- [tutorial] build librephotos using Tencent cloud lightweight application server to support photo management of face recognition!
- Performance optimization of database 5- database, table and data migration
- How to deal with the situation of repeated streaming and chaotic live broadcast in easydss?
- 北大、加州伯克利大学等联合| Domain-Adaptive Text Classification with Structured Knowledge from Unlabeled Data(基于未标记数据的结构化知识的领域自适应文本分类)
- Benchclock: a benchmark for evaluating semantic analysis language models
- Polar cycle graph and polar fan graph of high order histogram
- [js] generate random array
- Notepad++ installing the jsonview plug-in
- How the API gateway obtains the URI path and how the API handles local access failure
猜你喜欢
Performance optimization of database 5- database, table and data migration

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

从CVPR 2022看域泛化(Domain Generalization)最新研究进展

Peking University, University of California Berkeley and others jointly | domain adaptive text classification with structured knowledge from unlabeled data (Domain Adaptive Text Classification Based o

How to use the serial port assistant in STC ISP?

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

Hackinglab penetration test question 8:key can't find it again

Installation and use of Minio

Error running PyUIC: Cannot start process, the working directory ‘-m PyQt5. uic. pyuic register. ui -o

Polar cycle graph and polar fan graph of high order histogram
随机推荐
ICML2022 | 基于对比学习的离线元强化学习的鲁棒任务表示
Important announcement: Tencent cloud es' response strategy to log4j vulnerability
What is stock online account opening? Is it safe to open a mobile account?
How does the fortress remote login server operate? What is the application value of Fortress machine?
[open source]goravel, a fully functional and extensible golang web application framework
Knowda: all in one knowledge mixture model for data augmentation in feed shot NLP
Valid read-only attribute
[tutorial] build a personal email system using Tencent lightweight cloud
How to set the life cycle of API gateway
Leetcode must review six lintcode (28348455116385)
Peking University, University of California Berkeley and others jointly | domain adaptive text classification with structured knowledge from unlabeled data (Domain Adaptive Text Classification Based o
2008R2 CFS with NFS protocol
The time deviation is more than 15 hours (54000 seconds), and the time cannot be automatically calibrated
How does the national standard gb28181 security video platform easygbs download device video through the interface?
How to deal with high memory in API gateway how to maintain API gateway
WordPress plugin WP guppy 1.1 - WP JSON API sensitive information disclosure
How to build an API gateway and how to maintain an API gateway?
北大、加州伯克利大學等聯合| Domain-Adaptive Text Classification with Structured Knowledge from Unlabeled Data(基於未標記數據的結構化知識的領域自適應文本分類)
Ten thousand words! Understand the inheritedwidget local refresh mechanism
How many times can the server address and fortress address be entered before the connection is successful? Why did the connection fail?