linux - Why my limit on CPU does not validate via cgroups -


/etc/cgconfig.conf

...  group memlimit {     memory {         memory.limit_in_bytes = 8589934592;     } }  group cpulimit {     cpu {         cpu.shares = 1024;     } } 

/etc/cgrules.conf:

@gatewayer  memory  memlimit/ @gatewayer  cpu cpulimit/ 

and i've restarted services via commands:

service cgconfig restart service cgred restart 

after execute python script user belongs group gatewayer, see pid when executing cat /cgroup/memory/memlimit/cgroup.procs , limit have been applied on running process. however, limit on cpu not take effect, , cat /cgroup/cpu/cpulimit/cgroup.procs doesn't print pid expected.

i tried check on process, , turns out same result, memory limited cgroups whereas cpu not:

$ cat /proc/18113/cgroup  174:blkio:/ 173:net_cls:/ 172:freezer:/ 171:devices:/ 170:memory:/memlimit 169:cpuacct:/ 168:cpu:/ 167:cpuset:/ 

could give me help? many thanks.

it seems cgroups setting cpu.shares should correctly applied.

modern computer have multi-core cpu. python script used testing can use 100% of 1 core. if there still idle cpu cores, other script use 100% core.

the better way test cpu.shares run number of processes more number of cpu cores.

cat /proc/cpuinfo indicate number of cpu cores.


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -