All Products
Search
Document Center

Enterprise Distributed Application Service:Use URLs to forward traffic to instance groups of an application

Last Updated:Aug 14, 2023

After you associate a Server Load Balancer (SLB) instance with the instances of an application deployed on an Elastic Compute Service (ECS) cluster, you can configure different URL-based forwarding policies for different instance groups. The SLB instance can forward requests from different paths to different instance groups based on the specified forwarding policies. This topic describes how to configure URL-based forwarding policies to forward traffic to different instance groups of an application.

Prerequisites

Background information

In an ECS cluster, you can create multiple instance groups for an application, and deploy different versions of the application on the instance groups. After an SLB instance is associated with the instances of the application, the following scenarios may occur:

  • If no forwarding policies are configured for different instance groups, the traffic is randomly forwarded to the instances in each group.

  • If forwarding policies are configured for different instance groups, requests from different paths are forwarded to the instances in each group based on the specified policies.

For example, the URL o.domain.com/orders/queryitem is used to query product information in an ordering system. In the scenario of flash sales, this URL is frequently requested compared with the URLs of other services. In this case, you can deploy the service of querying product information to the flash sales-specific group, and deploy other services to the default group. Then, you can configure URL-based forwarding policies in the SLB instance. This way, the requests to query product information are forwarded to the flash sales-specific group, and other requests are forwarded to the default group.

在应用实例分组中绑定SLB架构示意图

Configure vServer groups and forwarding policies for instance groups

The following section describes how to configure vServer groups and forwarding policies based on the associated SLB instance for the two instance groups shown in the preceding figure.

Note

The procedure is the same. However, you cannot configure the same vServer group for both the instance groups.

  1. Log on to the EDAS console.

  2. In the left-side navigation pane, choose Application Management > Applications.

  3. In the top navigation bar of the Applications page, select the region where the application you want to manage resides. In the upper part, select the microservices namespace of the application. From the Cluster Type drop-down list, select ECS Clusters. Then, click the name of the application.

  4. On the Basic Information tab of the application, click the Instance Information tab.

  5. On the Instance Information tab, find the first instance group. The first instance group is the default group. In the upper-right corner of the instance group, click Group Settings and select Public-facing SLB Instance Information.

  6. In the Group Settings dialog box, configure a vServer group and a URL-based forwarding policy, and click Next.

    You can use one of the following methods to configure a vServer group and a URL-based forwarding policy for the instance group:

    • If you want to use an existing vServer group of the specified SLB instance, perform the following steps:

      1. Select Existing VServer Group and select an existing vServer group.

        Important

        A vServer group can be associated with only one application or application group.

      2. Configure a forwarding policy.

        • If you want to use an existing forwarding policy of the vServer group, select Modify the forwarding policy of the current VServer group and select an existing forwarding policy.

        • If the vServer group is not configured with a forwarding policy or you want to configure a new forwarding policy for the vServer group, select Add Forwarding Policy. In the Forwarding Policy field, enter a domain name and a path rule.

    • If the specified SLB instance is not configured with a vServer group or you want to associate a new vServer group with the application, perform the following steps:

      1. Select Create VServer Group. In the VServer Group Name field, enter a name for the vServer group.

      2. Select Add Forwarding Policy. In the Forwarding Policy field, enter a domain name and a path rule.

  7. In the SLB Change Order step, click Confirm.

Check the result

Check whether you can access the application by using the URL of each instance group.