Microservice Spring Cloud | 2.6 Apply Ribbon to achieve load balancing

1. Load balancing

Ribbon is a load balancing project open sourced by Netflix. It belongs to the client load balancer and runs on the client. It's a cloud-tested IPC library that provides good control over some behaviors of HTTP and TCP clients.
• Load balancing
• Fault tolerance
• Multi-protocol (HTTP, TCP, UDP) support for asynchronous and reactive models
• Caching and batching

2. Simple use of Ribbon

Springcloud already includes the Ribbon component, so there is no need to add anything else to the pom.
It is relatively simple to use. Simply add the @LoadBalanced annotation to the main class of the previous project microservice-consumer-movie to complete simple use. As shown below:
write picture description here

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324839356&siteId=291194637
Recommended