All Products
Search
Document Center

Alibaba Cloud Service Mesh:AverageLatencySchedulingPolicy field reference

Last Updated:Mar 11, 2026

The AverageLatencySchedulingPolicy Custom Resource Definition (CRD) configures latency-based adaptive load scheduling in Alibaba Cloud Service Mesh (ASM). It uses an Additive Increase Multiplicative Decrease (AIMD) algorithm to throttle request rates based on observed latency, protecting services from overload while maximizing throughput during recovery.

This reference describes every field in the CRD, grouped by object type.

AverageLatencySchedulingPolicySpec

Top-level specification for the policy resource.

FieldTypeRequiredDescription
load_scheduling_coreLoadSchedulingCoreYesCore scheduler configuration.

LoadSchedulingCore

Container for the load scheduling algorithm configuration.

FieldTypeRequiredDescription
aimd_load_schedulerAimdLoadSchedulerYesAIMD-based load scheduler configuration.

Selector

Determines which traffic flows the policy acts on, based on control point, flow labels, agent group, and service identity.

control_point: ingress
label_matcher:
  match_labels:
    user_tier: gold
  match_expressions:
    - key: query
      operator: In
      values:
        - insert
        - delete
  expression:
    label_matches:
      - label: user_agent
        regex: ^(?!.*Chrome).*Safari
FieldTypeRequiredDefaultDescription
control_pointstringNoingressLocation within the service where the policy takes effect. Valid values: ingress, egress, a specific listener, or a specific filter chain.
label_matcherLabelMatcherNo--Matches traffic flows based on flow labels.
servicestringNoanyFully Qualified Domain Name (FQDN) of the target service.

LabelMatcher

Matches traffic flows using one or more of three methods:

  1. Match labels -- exact key-value matching.

  2. Match expressions -- operator-based matching (In, NotIn, Exists, DoesNotExist).

  3. Arbitrary expression -- logical combinations with regex support.

When multiple methods are specified, they are combined with logical AND. An empty LabelMatcher matches all requests.

The following example excludes health check and metrics endpoints from scheduling. These endpoints do not represent real user traffic and can skew latency calculations:

label_matcher:
  match_list:
    - key: http.target
      operator: NotIn
      values:
        - /health
        - /live
        - /ready
        - /metrics
FieldTypeRequiredDescription
expressionExpressionNoLogical expression evaluated on flow labels.
match_labelsmap[string]stringNoKey-value pairs for exact label matching.
match_list[]MatchRequirementNoList of operator-based matching requirements.

Expression

A composable logical expression. Only one field can be set per Expression object.

# Match flows where label "foo" exists AND label "app" equals "frobnicator"
all:
  of:
    - label_exists: foo
    - label_equals:
        label: app
        value: frobnicator
FieldTypeDescription
allExpressionListTrue when all subexpressions are true (logical AND).
anyExpressionListTrue when any subexpression is true (logical OR).
label_equalsEqualExpressionTrue when the specified label equals the given value.
label_existsstringTrue when a label with the given name exists.
label_matchesMatchesExpressionTrue when the specified label matches the given regular expression.
notExpressionNegates the result of the subexpression.

ExpressionList

FieldTypeDescription
of[]ExpressionList of subexpressions.

EqualExpression

FieldTypeRequiredDescription
labelstringYesLabel key.
valuestringNoLabel value to match.

MatchesExpression

FieldTypeRequiredDescription
labelstringYesLabel key to match against.
regexstringYesRegular expression pattern. Uses Go RE2 syntax.

MatchRequirement

Operator-based label matching, following the same pattern as Kubernetes label selectors.

FieldTypeRequiredDescription
keystringYesLabel key.
operatorenumYesMatching operator. Valid values: In, NotIn, Exists, DoesNotExist.
values[]stringConditionalString values to match against. Required for In and NotIn. Must be empty for Exists and DoesNotExist.

AimdLoadScheduler

The AIMD load scheduler uses a gradient controller to adjust the token rate based on how far the observed latency signal deviates from the setpoint. When the system is overloaded, it multiplicatively decreases the token rate. During recovery, it linearly increases the rate until the system reaches steady state.

FieldTypeRequiredDefaultConstraintsDescription
gradientGradientControllerParametersYes----Gradient controller parameters. See GradientControllerParameters.
load_multiplier_linear_incrementfloat64No0.025Minimum: 0Linear increment applied to the load multiplier every 10 seconds while the system is not overloaded, until max_load_multiplier is reached.
load_schedulerLoadSchedulerParametersYes----Workload scheduler and selector configuration. See LoadSchedulerParameters.
max_load_multiplierfloat64No2Minimum: 0Maximum load multiplier during recovery from an overloaded state. When this value is reached, the scheduler enters pass-through mode -- requests bypass the scheduler and go directly to the service. Pass-through mode is disabled if the system becomes overloaded again. This field protects the service from request bursts while recovering.

GradientControllerParameters

The gradient controller adjusts the load multiplier based on the ratio of the observed signal to the setpoint. The slope field is the exponent applied to this ratio, controlling how aggressively the controller responds.

FieldTypeRequiredDefaultDescription
max_gradientfloat64No1Upper bound for the gradient value.
min_gradientfloat64No0.1Lower bound for the gradient value.
slopefloat64No-1Exponent on the signal-to-setpoint ratio. Controls the direction and aggressiveness of the response.

How slope works:

ValueBehavior
1Signal too high --> increase the control variable.
-1Signal too high --> decrease the control variable.
-0.5Signal too high --> decrease the control variable gradually.

Keep the absolute value of slope at or below 1.

LoadSchedulerParameters

Configures the Weighted Fair Queuing (WFQ)-based workload scheduler and specifies which traffic flows the policy applies to.

FieldTypeRequiredDefaultDescription
schedulerSchedulerNo--WFQ-based workload scheduler configuration.
selectors[]SelectorYes--Selectors that scope which traffic flows the scheduler manages.
workload_latency_based_tokensboolNofalseAutomatically estimate token cost per flow based on historical latency. Tokens are set to the average latency of flows in each workload over the last few seconds. Useful for concurrency limiting, where concurrency = average latency x in-flight flows. Explicit tokens in flow labels take highest precedence, followed by tokens in the workload definition, then estimated tokens.

Scheduler

FieldTypeRequiredDescription
workloads[]SchedulerWorkloadYesWorkload definitions for the WFQ scheduler.

SchedulerWorkload

Defines a workload -- a group of traffic flows that share the same scheduling parameters.

FieldTypeRequiredDescription
label_matcherLabelMatcherNoMatches traffic flows to this workload based on flow labels.
NamestringYesWorkload name.
ParametersSchedulerWorkloadParametersYesScheduling parameters for flows matching the label matcher.

SchedulerWorkloadParameters

Controls how traffic flows within a workload are prioritized and queued.

FieldTypeRequiredDescription
priorityfloat64NoThe priority.
queue_timeoutstringNoThe timeout for the traffic flows in the workload.
tokensfloat64NoCost of admitting a single flow. Typically defined as milliseconds of expected latency (time to response), or set to 1 when the resource is constrained by flow count (for example, third-party rate limiters). This value is used only when tokens are not specified in flow labels.