Centos 7和硬核CPU限制

OS版本信息:

[root@localhost system]# cat /etc/redhat-release CentOS Linux release 7.1.1503 (Core) 

test.slice的configuration如下:

 [root@localhost system]# cat test.slice [Unit] Description=Test Slice Documentation=man:systemd.special(7) DefaultDependencies=no Before=slices.target Wants=-.slice After=-.slice [Slice] CPUAccounting=on CPUShares=1024 

我创build了另一个文件(称为testhigh.slice),并给它CPU份额= 128。当我启动CPU饥饿的进程在任何时候,我看到CPU按比例划分,如预期。

但是 ,似乎没有办法实际上将一个切片的CPU限制到例如10%的恒定值。 CPUQuota选项无法被systemd识别:

 Apr 23 21:34:00 localhost.localdomain systemd[1]: [/usr/lib/systemd/system/test.slice:22] Unknown lvalue 'CPUQuota' in section 'Slice' 

原则上,能够精确分配资源将是惊人的,但现在我无法得到这个工作。 请帮忙; 如果可能的话,我想从systemd框架中获得一个解决scheme。