"Micro-Service Architecture" Springcloud Ribbon

Source: Internet
Author: User

A: What is the ribbon?

The Ribbon is an open source project released by Netfix, primarily responsible for client-side software load balancing algorithms that connect the middle tier of Netfix, and the Ribbon client component provides a complete set of configuration items such as connection timeouts, retries, and so on. To put it simply. is to list all the machines behind load Balancer (lb) in the configuration file, and the Ribbon will automatically help you to connect the machines based on certain rules (such as simple polling, immediate connections, etc.), and we can easily implement a custom load balancing algorithm using Riben;

II: LB Program classification

The current mainstream LB scheme can be divided into two categories, one of which is centralized lb, that is, the use of a separate lb facility between the consumer and provider of the service (which can be hardware, such as F5, or software, such as Nginx), which is the responsibility of the facility to forward access requests through a policy to the provider of the server. The other is the lb of the process class, which integrates the LB logic into the consumer. It is useful for consumers to obtain which addresses from the server registry, and then select a suitable server from those addresses. RIBBN is the latter, it's just a class library that consumers use to get to the server provider address.

Three: The main components and workflow of the Ribbon

The core components of the Ribbon, all of which are interface types, have the following:

ServerList is used to get the address list, which can be either static (providing a fixed set of addresses) or dynamic (the address list is queried periodically from the registry)

Serverlistfilter is used only when using ServerList. Use a certain policy to filter to a subset of addresses for the original service list.

IRule Select a final service address as the LB result, the selection strategy has polling, weighted by response time. Short circuit, etc.,

The ribbon prefers to use serverlist to get a list of all available services at work, then filters out a portion of the address through Serverlistfilte, and finally selects a server in the remaining address through Irule for the final result.

IV: Introduction to the main load balancing strategy provided by the Ribbon

1. Simple polling for load balancing.

The request is polled in turn to schedule the different servers, that is, each time the schedule executes i = (i + 1) mod n, and the first server is selected.

2: Stochastic load Balancing (random)

Randomly select server with a status of up

3 Weighted Load Balancing

The longer the response time, the smaller the weight, the less likely it is to be selected, depending on the time allocated for a weight.

4, Zone-aware polling for load balancing (zoneavoidancerule)

Compound to determine the performance of the server area and the availability of the server Select server

Ribbon self-load balancing strategy comparison

V: Ribbon used alone

Build a service consumer

Re-establish a Springboot project, named: Service-ribbon;

Its pom.xml file is as follows:

"Micro-Service Architecture" Springcloud Ribbon

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.