当前位置:网站首页>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 .
边栏推荐
- Shell automatically obtains hardware information
- How to improve the content quality of short video, these four elements must be achieved
- How to do API gateway routing? What are the other functions of API gateway?
- [open source]goravel, a fully functional and extensible golang web application framework
- What is stock online account opening? Is it safe to open a mobile account?
- Practice of business level disaster recovery switching drill
- New high-speed random graph API interface, the first sci-fi graph API interface
- 使用 Provider 改造屎一样的代码,代码量降低了2/3!
- Hugegraph: hugegraph Hubble web based visual graph management
- 从CVPR 2022看域泛化(Domain Generalization)最新研究进展
猜你喜欢

Teacher lihongyi from National Taiwan University - grade Descent 2

Introduction to scikit learn machine learning practice

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

The latest research progress of domain generalization from CVPR 2022

Ten thousand words! Understand the inheritedwidget local refresh mechanism

How to improve the content quality of short video, these four elements must be achieved

Icml2022 | robust task representation for off-line meta reinforcement learning based on contrastive learning

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

Experiment 5 module, package and Library
随机推荐
Environment construction of go language foundation
What is the meaning of the two-way and one-way cn2 lines in Hong Kong, China?
Analysis of Alibaba cloud Tianchi competition -- prediction of o2o coupon
You must like these free subtitle online tools: Video subtitle extraction, subtitle online translation, double subtitle merging
Command line enumeration, obtaining and modifying time zones
Nanny level anti crawling teaching, JS reverse implementation of font anti crawling
Take you to understand the lazy loading of pictures
Code implementation of CAD drawing online web measurement tool (measuring distance, area, angle, etc.)
How to build an API gateway and how to maintain an API gateway?
2021-12-19: find the missing numbers in all arrays. Give you an n
Hackinglab penetration test question 8:key can't find it again
Smart cockpit SOC competition upgraded, and domestic 7Nm chips ushered in an important breakthrough
How do API gateways set up dynamic routing? What are the benefits of dynamic routing?
What is API gateway link tracking? What is the function of the line monitoring tool?
What is stock online account opening? Is it safe to open a mobile account?
Talking about using email to attack social engineering
DM sub database and sub table DDL "pessimistic coordination" mode introduction - tidb tool sharing
Error message - Customizing incorrectly maintained – in transaction code ML81N
How to defend the security importance of API gateway
v-chart