Linux – difference between different cpu.cfs_period_us values

linux-kernel

I'm reading kernel[1] docs and confused about the cpu.cfs_period_us in this part:

3. Limit a group to 20% of 1 CPU.

    With 50ms period, 10ms quota will be equivalent to 20% of 1 CPU.

    # echo 10000 > cpu.cfs_quota_us /* quota = 10ms */
    # echo 50000 > cpu.cfs_period_us /* period = 50ms */

    By using a small period here we are ensuring a consistent latency
    response at the expense of burst capacity.

I'm not clear about the what's the difference if I "use a small period":

what's meaning of ensuring a consistent latency response at the expense of burst capacity ?

[1]https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt

Best Answer

When the CPU bandwidth consumption of a group exceeds this limit [quota] (for that period), the tasks belonging to its hierarchy will be throttled and are not allowed to run again until the next period.

I'd say that they are trying to point out, that if you provision 10 seconds of CPU time in a minute, then the app can be stopped for 50 seconds as it is out of provisioned time. 10 seconds running uninterrupted at full power, 50 seconds nothing. This is good, if you have app, that needs to do very intensive computation as quickly as possible. Once in a while.

On the other hand, if you set it very low, like 50us out of 500us, then your app will run for just 0.05ms before being stopped and resumed 0.45ms later. Burst of 50us is not a burst :) ... but the app is stopped for 0.45ms at most. This would be good, if you have an app, that does not compute very much, but needs to have very low latency, as the time, that the app is throttled, adds to the latency.

(intentionally using numbers out of proportion)

Related Question