Skip to the content.

Directory

1. Group Intro

When your cluster is on the scale, the server may be deployed in different computer rooms or network segments. In order to reduce cross network calls and ensure the priority of service calls of the same group, tars has designed a grouping mechanism.

At present, tars designs two groups: IDC group and set group

2. IDC Group Intro

2.1. IDC Group

2.2. Change of group information

In the “service editing” of the management platform, it is changed by the operator and saved in the tars dB after the change. The main control Registry will read into its own cache every certain time.

2.3. Execution flow of grouping logic

The client will regularly take the information of the obj list from the registry. After receiving the request, the Registry will complete the core logic of IDC grouping.

The core process is as follows:

2.4. Examples

tars

Server A has seven services (A1,A2,A3,A4,A5,A6,A7) The deployment of IDC in each region is shown in the figure above。

Client B(ip:172.27.206.111) call server A: it can call A3

Client B call server A: it can call A3,A4,A5

Client B call server A: if A3,A4,A5 stoped, it can call A2

Client B call server A: if A3,A4,A5,A2 stoped,it can call A1,A7

Client B call server A: if A3,A4,A5,A2,A1,A7 stoped,it can callA6

3. Introduction to set grouping logic

3.1. Meaning of set grouping

3.2. Set Group Intro

Before set grouping, see the following figure:

tars

After set grouping, see the following figure:

tars

3.3. Call logic rules for set grouping

The following figure is an example:

tars

The specific deployment is as follows:

Set Name Set Region Set Group Server List
APP SZ 1 A,B,C,F
APP SZ 2 A,B,C
APP SZ *(wildcard) C,E,D,F
APP SH 1 A,B,C
APP SH 2 A,B,C
  1. A service calls B and C services, and the three services exist in both set groups 1 and 2. If B service in 1 dies, a will not call B service in 2, nor any B service in SH, but directly return empty set to a, because it is not in the same set.

  2. As for C service, it exists in both 1, 2 set group and SZ region. If C in 1 is dead, it will neither call C in SZ region nor C in 2. Similarly, compared with F service, A service in 1 will never call f service in wildcard group.

  3. For the a service in 2, the f service in the wildcard group can be called

  4. D service can call any C service in SZ (including wildcard group and specific set service group)

  5. For e service, C directly calls e service in the wildcard group

Call general principles:

4. Call rules of IDC group and set group

No Client Server Rule
1 Open Set Open Set Find the IP address in the same set, and return empty if there is no available address in the same set
2 Open Set Not Open Set/ Open IDC Address return address grouped by IDC
3 Open Set Not Open Set/ Not Open IDC Return all available addresses
4 Not Open Set Open Set/ Open IDC Address return address grouped by IDC
5 Not Open Set Open Set/ Not Open IDC Return all available addresses
6 Not Open Set Not Open Set/ Open IDC Address return address grouped by IDC
7 Not Open Set Not Open Set/ Not Open IDC Return all available addresses