Skip to content

xds: don't model all supported route actions as weighted_clusters #8858

@easwars

Description

@easwars

The config_selector inside xDS resolver has a list of routes. See:

The route struct is defined here:

and has a matcher to match the incoming RPC and a clusters field which represents the cluters to which the matching RPC needs to be routed to. But the clusters field is of type wrr.WRR. See:
clusters wrr.WRR // holds *routeCluster entries

This means that for the single-cluster case (which is the most common case) and the cluster_specifier_plugin case, we will still incur the cost of generating a random number for every RPC. At RPC time, SelectConfig is invoked which picks the cluster out of the matching route here:

cluster, ok := rt.clusters.Next().(*routeCluster)

And the random WRR implementation has to generate a random number for every call to Next. See:

func (rw *randomWRR) Next() (item any) {

This is something that should be avoided for performance reasons.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area: xDSIncludes everything xDS related, including LB policies used with xDS.P2Status: Help WantedType: PerformancePerformance improvements (CPU, network, memory, etc)

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions