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:Jun 05, 2023

The adaptive xDS optimization feature analyzes the call dependencies among services in a Service Mesh (ASM) instance based on access logs, and automatically generates sidecars that contain the service-specific configurations. This is more efficient compared with the mechanism where the control plane pushes configurations of all services to the sidecar of each service on the data plane. This topic describes how to use the adaptive xDS optimization feature.

Prerequisites

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

Background information

By default, a sidecar stores information about all services on the data plane because the control plane cannot determine 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 sidecars 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 sidecars on the data plane.

You can use the adaptive xDS optimization feature to automatically generate sidecars for services. After you enable the feature, an egress gateway named istio-axds-egressgateway is deployed in the 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. 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 applies only to the 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 that appears, click OK.

    Updating is displayed below the 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 appears below the switch.

Step 2: Enable the xDS optimization feature for a namespace

After you enable the xDS optimization feature for a namespace, the configuration push is optimized for all services in the namespace, and sidecars 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. On the details page of the ASM instance, choose Mesh Optimization Center > Adaptive xds optimization in the left-side navigation pane.

  2. On the Adaptive xds optimization page, find the namespace in which your services reside, and turn on the switch in the Status column. In the Submit message that appears, click OK.

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

  4. On the Sidecar page, view the automatically-created sidecars.

    All sidecars that are automatically created are displayed on the page, and the sidercar names start with axds. Each sidecar corresponds to a service of the Bookinfo application that is deployed in the ASM instance. Sidecar

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

  1. Obtain the IP address of the ingress gateway.

    1. Log on to the ACK console and click Clusters in the left-side navigation pane.

    2. On the Clusters page, click the name of a cluster and choose Network > Services in the left-side navigation pane.

    3. In the upper part of the Services page, select istio-system from the Namespace drop-down list. Find the ingress gateway that is named istio-ingressgateway and view the IP address whose port is 80 in the External Endpoint column.

      The IP address that contains the 80 port is the IP address of the ingress gateway.

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

  3. View the sidecar.

    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.
    3. On the Sidecar page, find the axds-productpage sidecar and click View YAML in the Actions column.

      Sample YAML file:

      apiVersion: networking.istio.io/v1beta1
      kind: Sidecar
      metadata:
        annotations:
          adapted-svc: productpage.default.svc.cluster.local
        labels:
          asm-adaptive-xds-system: 'true'
          asm-system: 'true'
          provider: asm
        name: axds-productpage
        namespace: default
      spec:
        egress:
          - hosts:
              - 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

      In the YAML file, the axds-productpage sidecar that is automatically generated for the productpage service contains 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 that appears, click OK.

    Updating is displayed below the 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 in the left-side navigation pane.

    The sidecars that were created by using the xDS optimization feature are deleted.