我正在阅读 kernel[1] 文档并对cpu.cfs_period_us这部分内容感到困惑:
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.
Run Code Online (Sandbox Code Playgroud)
如果我“使用一小段时间”,我不清楚有什么区别:
是什么意思ensuring a consistent latency response at the expense of burst capacity?
[1] https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt
小智 5
当某个组的 CPU 带宽消耗超过此限制 [配额](针对该时间段)时,属于其层次结构的任务将受到限制,并且在下一个时间段之前不允许再次运行。
我想说的是,他们试图指出,如果您在一分钟内预配 10 秒的 CPU 时间,那么应用程序可以停止 50 秒,因为它已超出预配时间。全功率运行 10 秒不间断,50 秒什么也没有。这很好,如果您有应用程序,需要尽快进行非常密集的计算。偶尔。
另一方面,如果您将其设置得非常低,例如 500us 中的 50us,那么您的应用程序将仅运行 0.05 毫秒,然后停止并在 0.45 毫秒后恢复。50us 的突发不是突发 :) ...但该应用程序最多停止 0.45 毫秒。这会很好,如果您有一个应用程序,它的计算量不是很大,但需要具有非常低的延迟,因为应用程序被限制的时间会增加延迟。
(故意不成比例地使用数字)