当前位置:网站首页>Ribbon service invocation and load balancing
Ribbon service invocation and load balancing
2022-06-29 06:35:00 【Miaoshiansen likes fish】
Learn from the previous content , Service registration and service discovery have been implemented . When you start a service , Can pass HTTP To register information in the registry , And through SpringCloud Provides a tool to get a list of Registry Services . But there are still many problems in the call between services , How to call microservices more conveniently , How to choose multiple micro service providers , How to load balance and so on .
One 、Ribbon summary
1.1 What is? Ribbon
Ribbon yes Netflix Released a load balancer , It helps to control HTTP and TCP Client behavior . stay SpringCloud in ,Eureka General coordination Ribbon To use ,Ribbon It provides the function of client load balancing ,Ribbon Use from Eureka Service information read in , When calling the service provided by the service node , The load will be reasonable .
stay SpringCloud The registry and Ribbon In combination with ,Ribbon Automatically get the list information of service providers from the registry , And based on the built-in load balancing algorithm , Request service .
1.2 Ribbon Main role of
(1) The service call
be based on Ribbon Implement service calls , It is composed of all service lists pulled ( service name - Request path ) The mapping relationship . With the help of RestTemplate Finally call .
(2) Load balancing
When there are multiple service providers ,Ribbon According to the load balancing algorithm ( Such as simple polling 、 Random connection, etc ) Automatically select the service address to be called .
1.3 Ribbon Load balancing and Nginx The difference between load balancing
LB Load balancing (Load Balance) What is it? ? To put it simply, users' requests are evenly distributed to multiple services , So as to achieve systematic HA( High availability ). Common load balancing software Nginx,LVS, Hardware F5 etc. .
Nginx It's server load balancing , All client requests are delivered to Nginx, Then from Nginx Implement forwarding request , That is, load balancing is performed by , Server implementation .
Ribbon Local load balancing , When the micro interface is called , After obtaining the list of registration information services in the Registration Center , The cache to JVM Local , Thus in Local implementation RPC Remote service call technology .
Centralized LB: I.e. use independent... Between consumers and providers of services LB facilities ( It can be hardware , Such as F5, It can also be software , Such as Nginx), The facility payload forwards the access request to the service provider through some policy .
In process LB: take LB Logic is integrated into the consumer , The consumer knows from the service registry what addresses are available , Then I choose a suitable server from these addresses .Ribbon It's in the process LB, It's just a class library , Integrated into consumer processes , The consumer uses it to get the address of the service provider .
边栏推荐
- What are the uses of final?
- Hyperledger Fabric 2. X custom smart contract
- Easy to understand TCP four waves (multi picture explanation)
- Will the order of where conditions in MySQL affect the union index? Will where 1 =1 affect the use of the index? Does where 1 =1 affect the use of indexes?
- The echares map is implemented separately by provinces, and the tooltip user-defined prompt box, scattered annotation and scattered illumination are explained in detail
- How does MySQL implement distributed locks?
- Single application and microservice application
- QT writing map comprehensive application 58 compatible with multi browser kernel
- ASP. Net core 6 framework unveiling example demonstration [03]:dapr initial experience
- [Flink] flinksql and table programming cases
猜你喜欢

RedisTemplate处理hash整数类型的问题解析

What is the "danksharding" of V God Kop on Valentine's day?

Design and practice of kubernetes cluster and application monitoring scheme

It turns out that the joys and sorrows of programmers are not interlinked

MySQL learning notes

Linux Installation redis

Leetcode simple question: judging the color of a grid on a chess board

力扣今日题-324. 摆动排序 II

Creation of Arduino uno development environment
![[chromium] win10 vs2019 environment chromium configuration and compilation.](/img/20/428e6b22ed6955a732dd14d5ff0e3d.jpg)
[chromium] win10 vs2019 environment chromium configuration and compilation.
随机推荐
Activiti Designer
2022.02.15 - 240. Lucky number in matrix
P5 DS - component and document Association
Illustrate plug-in -- AI plug-in development -- creative plug-in -- astute graphics -- length and angle measurement function
Hustoj SPJ example
Leetcode simple question: judging the color of a grid on a chess board
Regular expressions for shell script values
Meta metauniverse female safety problems occur frequently. How to solve the relevant problems in the metauniverse?
Aging design guide for applets
力扣每日一题-第30天-1281.整数的各位积和之差
2022.02.14 - 239. A single element in an ordered array
VLAN experiment
Convert data frame with date column to timeseries
QT (x): packaging and deployment
Hyperledger Fabric 2. X custom smart contract
How to combine two byte arrays [repeat] - how to combine two byte arrays [duplicate]
After “Go to Definition”, is there a command to return to where you came from?
Personal blog item: processing of reading number +1 after viewing article details
'only_ full_ group_ The influence of by'sql mode on group by and its treatment
QT (x): control operation