All Products
Search
Document Center

Alibaba Cloud Service Mesh:Use adaptive xDS optimization to improve the configuration push efficiency of the control plane

Last Updated:Feb 22, 2024

When the efficiency is low because the control plane pushes a large number of irrelevant configurations to the data plane, you can use the adaptive xDS optimization feature to improve the push efficiency of the control plane. By analyzing the actual call relationships between services, this feature automatically generates optimized sidecar CustomResourceDefinitions (CRDs) for services and pushes required sidecar configurations only for necessary services. This reduces unnecessary network communication and improves the performance and response speed of Service Mesh (ASM).

Prerequisites

Traffic is routed to different versions of a service by using Istio resources.

Background information

By default, a sidecar proxy stores information about all services on the data plane because the control plane does not know the call dependencies among the services. Each time you modify configurations on the control plane or data plane, the control plane pushes the new configurations to all sidecar proxies on the data plane. For example, if you create a virtual service on the control plane, the control plane pushes information about the virtual service to all sidecar proxies on the data plane.

You can use the adaptive xDS optimization feature to automatically generate sidecar CRDs for services. After you enable the feature, an egress gateway named istio-axds-egressgateway is deployed in the corresponding Kubernetes cluster and all HTTP traffic is first routed to the egress gateway. The feature automatically analyzes the call dependencies among services in the ASM instance based on the access logs of the egress gateway. For more information about the benefits, see Effects of sidecar recommendation on configuration push optimization.

Limits

  • The version of the ASM instance must be 1.15.3.63 or later. For more information about how to update an ASM instance, see Update an ASM instance.

  • The feature is available only to services that are accessed over HTTP.

Step 1: Enable the adaptive xDS optimization feature

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose Mesh Optimization Center > Adaptive xds optimization.

  3. On the Adaptive xds optimization page, turn on the Enable adaptive xds optimization switch. In the Submit message, click OK.

    After you click OK, Updating is displayed below the Enable adaptive xds optimization switch. Wait until the update is complete. When the update is complete, the Enable adaptive xds optimization switch is turned on and a list of namespaces for which this feature can take effect is displayed below the switch.

Step 2: Enable the adaptive xDS optimization feature for a namespace

After you enable the adaptive xDS optimization feature for a namespace, the configuration push efficiency is optimized for all services in the namespace, and sidecar CRDs that contain service dependencies are automatically generated for the services. You can also add asm.alibabacloud.com/asm-adaptive-xds: true to the annotations of a service to enable the feature for the service.

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose Mesh Optimization Center > Adaptive xds optimization.

  3. In the Select namespaces to be optimized section on the Adaptive xds optimization page, find the namespace in which your services reside, and turn on the switch in the Status column. Then, click OK in the Submit message. In this example, the default namespace is used.

  4. On the details page of the ASM instance, choose Traffic Management Center > Sidecar Traffic Configuration in the left-side navigation pane.

  5. On the Sidecar Traffic Configuration page, view the automatically created sidecar CRDs.

    All sidecar CRDs that are automatically created by this feature are displayed on the page, and the names of such sidecar CRDs start with axds. Each sidecar CRD corresponds to a service of the Bookinfo application that is deployed in prerequisites.Sidecar资源

Step 3: Access the Bookinfo application to verify that the feature takes effect

  1. Obtain the IP address of the ingress gateway. For more information, see Substep 1 of Step 3 in the Use Istio resources to route traffic to different versions of a service topic.

  2. In the address bar of your browser, enter http://{IP address of the ingress gateway}/productpage to access the Bookinfo application.

    Replace {IP address of the ingress gateway} with the IP address obtained in the previous substep.

  3. View the sidecar CRDs.

    1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

    2. On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose Traffic Management Center > Sidecar Traffic Configuration.

    3. On the Sidecar Traffic Configuration page, find the axds-productpage sidecar CRD and click YAML in the Actions column.

      Sample YAML code:

      apiVersion: networking.istio.io/v1beta1
      kind: Sidecar
      metadata:
        annotations:
          adapted-svc: productpage.default.svc.cluster.local
        creationTimestamp: '2024-01-05T07:52:56Z'
        generation: 4
        labels:
          asm-adaptive-xds-system: 'true'
          asm-system: 'true'
          provider: asm
        name: axds-productpage
        namespace: default
        resourceVersion: '23688435'
        uid: 753e3603-6bee-4dd1-b1fc-2e735a88****
      spec:
        egress:
          - hosts:
              - arms-prom/*
              - default/details.default.svc.cluster.local
              - default/kubernetes.default.svc.cluster.local
              - default/reviews.default.svc.cluster.local
              - istio-system/*
              - kube-system/*
        workloadSelector:
          labels:
            app: productpage

      The preceding sample code shows that the axds-productpage sidecar CRD that is automatically generated for the productpage service contains the details and reviews services on which the productpage service depends.

Related operations

Disable the adaptive xDS optimization feature

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose Mesh Optimization Center > Adaptive xds optimization.

  3. On the Adaptive xds optimization page, turn off the Enable adaptive xds optimization switch. In the Submit message, click OK.

    After you click OK, Updating is displayed below the Enable adaptive xds optimization switch. Wait until the update is complete. When the update is complete, the Enable adaptive xds optimization switch is turned off.

  4. On the details page of the ASM instance, choose Traffic Management Center > Sidecar Traffic Configuration in the left-side navigation pane.

    The sidecar CRDs that were created by the adaptive xDS optimization feature are deleted.

Modify the configurations of an egress gateway

After you enable the feature, an egress gateway named istio-axds-egressgateway is deployed in the corresponding Kubernetes cluster and all HTTP traffic is first routed to the egress gateway. The feature automatically analyzes the call dependencies between services in the ASM instance based on the access logs of the egress gateway. You can view the details of this egress gateway in the ACK console by selecting the cluster and then choosing Network > Services in the left-side navigation pane. You can modify the configurations of the egress gateway based on your business requirements to handle different traffic scenarios.

  1. Log on to the ASM console. In the left-side navigation pane, choose Service Mesh > Mesh Management.

  2. On the Mesh Management page, click the name of the ASM instance. In the left-side navigation pane, choose Mesh Optimization Center > Adaptive xds optimization.

  3. On the Adaptive xds optimization page, click the Egress Gateway Configurations tab, modify the configurations of the egress gateway based on your business requirements, and then click Update Settings.

    After you click Update Settings, the ASM instance temporarily enters the Updating state. After the update is complete, you can see that the configurations of the egress gateway are updated as expected.

    Note

    You can modify the following configurations of the egress gateway: Egress Gateway Resource Settings, Gateway instances, HPA, metrics, Threshold, Maximum replicas, and Minimum number of replicas.