Skip to content

Support for slow start with WRR Load Balancer Policy #12087

Open

Description

@altaiezior

Is your feature request related to a problem?

#10688

Describe the solution you'd like

As per the above issue which was closed earlier, we recently tried WRR load balancing policy and with a few modification we can allow support for slow start. More details are available on the earlier issue.

In WRR conifg we have an option as blackout period which signifies that an endpoint when added to the address list, may be because it is a new endpoint or it has been removed before and added again, blackout period signify that we should wait for this much time before we start using the weights of this endpoint.

So as per the RFC we assign it mean weight of all the endpoints so it receives some amount of traffic, but this itself can be a huge traffic if the pod is just starting. We can may be use the blackout period seconds to clamp down this average weight and hence achieve a slow start result.

In the official envoy documentation we have the formula defined as

new_weight = weight * max(min_weight_percent, time_factor ^ (1/agression))
time_factor = max(time_start_in_seconds, 1) / slow_start_window_seconds

Here the aggression defines the slope of traffic increase and when it is 1 which is by default it increases traffic linearly.

We can either define and use the same configuration to update our weights or instead we can assume the aggression to be 1 and slow_start_window_seconds to be blackout_period and min_weight_percent = 0. We can also assume the weight here to be the mean_weight or the max_weight.

The formula can then be simplified as

new_weight = mean_weight * max(time_start_in_seconds, 1) / black_out_period

As per the definition of blackout_period it depends on the implementation how it chooses to send traffic, so if we define this logic for GRPC implementation, it should ideally not be an issue and yet we can achieve better results in comparison to the current implementation.

May be at a later stage we can consume the config directly and update weights to provide users more functionality to configure aggression and min_weight_percentage.

Activity

  1. altaiezior commented on May 29, 2025

    @altaiezior
    Author

    We implemented in our servers with the above changes by making a custom LB policy and making the desired changes and the results are as follows

    Image

    Here the blackout period is set to 10 mins

    Let me know @ejona86 if it can be part of the grpc-xds WRR policy itself

  2. ejona86 commented on May 29, 2025

    @ejona86
    Member

    I was looking at this yesterday. I think the overall feature makes sense to support. If you are willing to contribute the implementation, then I think the main thing would be to make a gRFC. We'll need to be a little careful to make sure we're matching the Envoy semantics for when to start slow start and such.

    I'm talking with others to see if Envoy's Slow Start is actually compatible with a WRR implementation in Envoy, as I suspect it only impacts endpoint weights (like those that come from EDS), which WRR ignores. But worst-case we should be able to put the config directly in WRR.

  3. altaiezior commented on May 29, 2025

    @altaiezior
    Author

    So as far as I understand from the code, it is currently not supported in envoy, I am opening an issue in the envoy as well for the same.

    I am willing to contribute, since we have already implemented this at our end and using it.

    At present what we are doing is that from the ChildLbState we are also fetching the scale, which is 1 by default and linearly increasing in case of blackout period. Then using that scale at the time of final weight computation.

    Although I believe a proper solution would be instead to use the slow_start_config with WRR or as you suggested in the worst case to put the config in the WRR itself.

    This would be my first contribution to the repo, so would need some help in discussing and finalising the gRFC for the same, let me know how can I contribute.

  4. ejona86 commented on May 29, 2025

    @ejona86
    Member

    I was shown that SlowStartConfig is directly in the RR and least_request configs, so it going in ClientSideWeightedRoundRobin would make sense in all cases.

  5. altaiezior commented on May 29, 2025

    @altaiezior
    Author

    Oh that is awesome, I earlier failed to notice that. This makes config passing much easier.

    So how do we go about this, do we have to make changes in the envoy proto for the config first?

  6. ejona86 commented on May 30, 2025

    @ejona86
    Member

    You'll need to make changes to the envoy proto, but probably start with the gRFC. One of the reviewers of the gRFC is also an Envoy API owner (markdroth), so when we get there he can help you out. He's one of the people I was talking with about this, and he sees no issue updating the Envoy proto. If you send it out earlier, I don't think there'd be any harm, but it probably doesn't help.

  7. altaiezior commented on May 30, 2025

    @altaiezior
    Author

    Sure I will try to work on the gRFC, I have one doubt though. How do we plan to use both blackout period seconds and warmup period seconds

    I was thinking both can work independently, blackout period will help in deciding the weight which can be according to the actual metrics if blackout period is passed or mean weight if within blackout period

    Warmup period should give us scale, if within warmup period we will use the formula to compute scale or else 1

    Whatever weight is decided be it because of blackout or not we can scale the weight.

    There can be 2 use cases:

    1. Blackout period is less than warmup period means that even if we have the actual weight we need to gradually scale them and not jump to the actual number
    2. Blackout period is greater than warmup period means that we gradually increase till a point and then wait for blackout - warmup more time to collect more reliable data for better scaling
  8. altaiezior commented on May 31, 2025

    @altaiezior
    Author
  9. added this to the Unscheduled milestone on Nov 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions