》一文中创建的 docker 镜像 u-stress 进行压力测试,文中就不再过多的解释了。
$ docker run -it -- --cpus= u-stress:latest /bin/bash
# stress -c
Specify how much of the available CPU resources a container can use.,人家的初衷也是要表示 CPU 个数的)。
$ docker run -it -- --cpu-period= --cpu-quota= u-stress:latest /bin/bash
。我们要知道这两个选项才是事实的真相,但是真相往往很残忍!还好 --cpus 选项成功的解救了我们,其实它就是包装了 --cpu-period 和 --cpu-quota。
$ docker run -it -- --cpuset-cpus= u-stress:latest /bin/bash
# stress -c
:
$ docker run -it -- --cpuset-cpus= u-stress:latest /bin/bash
$ docker run -it -- --cpuset-cpus= --cpu-shares= u-stress:latest /bin/-it -- --cpuset-cpus= --cpu-shares= u-stress:latest /bin/bash