Route convergence in the same data center

更新时间:
复制 MD 格式

When you have multiple data centers, Remote Procedure Call (RPC) requests may be sent between them. This can increase invocation time due to network latency and other factors. To ensure service quality, you can configure same-data-center route convergence. This configuration directs RPC requests to prioritize services on servers within the same data center.

Invocation flow

Image 2

Note

The data structure shown is a simplified example. It does not represent the actual structure.

  • datacenter: The physical data center where the server is located.

  • zone: A logical unit created within a physical data center for easier management. The datacenter and zone together identify the server's location.

The invocation flow is as follows:

  1. Service providers A and B register their services with the registry center.

  2. The service invoker subscribes to the address information of all service providers in the registry center.

  3. When the invoker calls a service, it prioritizes the addresses of service providers whose datacenter and zone configurations match its own.

  4. If no service is available in the current zone, the invoker calls services in other zones.

Configuration

Add the service's location information to the service startup parameters:

-Dcom.alipay.ldc.zone=xxx
-Dcom.alipay.ldc.datacenter=xxx

Same-data-center route convergence is enabled by default. If you do not configure the datacenter and zone parameters, the system uses default values. This results in all services having the same datacenter and zone, which makes route convergence ineffective.

Notes

  • Same-data-center route convergence prioritizes services in the local zone. When you deploy services, ensure that you balance the number of services across all zones. This prevents a situation where one zone has high traffic but an insufficient number of services to handle the load.

  • The combination of the datacenter and zone parameters identifies a unique location. However, some versions do not recognize the datacenter parameter. For this reason, you must ensure that zone names are unique across all data centers.

  • On Alibaba Cloud, the datacenter and zone parameters correspond to an Alibaba Cloud data center and cell, respectively. To simplify maintenance, you should use the predefined names instead of creating your own.