Re: [PATCH v4 1/4] sched/fair: Introduce primitives for CFS bandwidth burst

From: changhuaixin
Date: Wed Mar 17 2021 - 21:26:07 EST




> On Mar 17, 2021, at 4:06 PM, Peter Zijlstra <peterz@xxxxxxxxxxxxx> wrote:
>
> On Wed, Mar 17, 2021 at 03:16:18PM +0800, changhuaixin wrote:
>
>>> Why do you allow such a large burst? I would expect something like:
>>>
>>> if (burst > quote)
>>> return -EINVAL;
>>>
>>> That limits the variance in the system. Allowing super long bursts seems
>>> to defeat the entire purpose of bandwidth control.
>>
>> I understand your concern. Surely large burst value might allow super
>> long bursts thus preventing bandwidth control entirely for a long
>> time.
>>
>> However, I am afraid it is hard to decide what the maximum burst
>> should be from the bandwidth control mechanism itself. Allowing some
>> burst to the maximum of quota is helpful, but not enough. There are
>> cases where workloads are bursty that they need many times more than
>> quota in a single period. In such cases, limiting burst to the maximum
>> of quota fails to meet the needs.
>>
>> Thus, I wonder whether is it acceptable to leave the maximum burst to
>> users. If the desired behavior is to allow some burst, configure burst
>> accordingly. If that is causing variance, use share or other fairness
>> mechanism. And if fairness mechanism still fails to coordinate, do not
>> use burst maybe.
>
> It's not fairness, bandwidth control is about isolation, and burst
> introduces interference.
>
>> In this way, cfs_b->buffer can be removed while cfs_b->max_overrun is
>> still needed maybe.
>
> So what is the typical avg,stdev,max and mode for the workloads where you find
> you need this?
>
> I would really like to put a limit on the burst. IMO a workload that has
> a burst many times longer than the quota is plain broken.

I see. Then the problem comes down to how large the limit on burst shall be.

I have sampled the CPU usage of a bursty container in 100ms periods. The statistics are:
average : 42.2%
stddev : 81.5%
max : 844.5%
P95 : 183.3%
P99 : 437.0%

If quota is 100000ms, burst buffer needs to be 8 times more in order for this workload not to be throttled.
I can't say this is typical, but these workloads exist. On a machine running Kubernetes containers,
where there is often room for such burst and the interference is hard to notice, users would prefer
allowing such burst to being throttled occasionally.

In this sense, I suggest limit burst buffer to 16 times of quota or around. That should be enough for users to
improve tail latency caused by throttling. And users might choose a smaller one or even none, if the interference
is unacceptable. What do you think?