-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Open
Labels
Area: xDSIncludes everything xDS related, including LB policies used with xDS.Includes everything xDS related, including LB policies used with xDS.P2Status: Help WantedType: PerformancePerformance improvements (CPU, network, memory, etc)Performance improvements (CPU, network, memory, etc)
Description
The config_selector inside xDS resolver has a list of routes. See:
| routes []route |
The route struct is defined here:
| type route struct { |
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:
grpc-go/internal/wrr/random.go
Line 51 in c7ec4d9
| func (rw *randomWRR) Next() (item any) { |
This is something that should be avoided for performance reasons.
Metadata
Metadata
Assignees
Labels
Area: xDSIncludes everything xDS related, including LB policies used with xDS.Includes everything xDS related, including LB policies used with xDS.P2Status: Help WantedType: PerformancePerformance improvements (CPU, network, memory, etc)Performance improvements (CPU, network, memory, etc)