docker run –cpuset is not having any effect

I started one docker container by specifying the cpuset to 1 cores:

docker run --cpuset-cpus="0"...

A second one by specifying the cpuset to 4 cores:

  • Setting absolute limits on CPU for Docker containers
  • Get Docker Container CPU Usage as Percentage
  • Memory usage of Docker containers
  • Docker CPU percentage
  • Oracle impdp running way too long
  • Limiting a Docker Container to a single cpu core
  • docker run --cpuset-cpus="0-3"...

    I launched a load process within each container and I monitored the cpu consumption for both containers.

    The load process is like:

    ffmpeg input > output

    I have observed that there is no improvement in term of execution time between both containers (no speed up).

    Do you have any idea why there is no improvements? container with 4 cores should run faster than 1 core container right ?

    using top for 1core container


    using top for 4core container, docker chooses randomly one of 4 cores to launch the process. Sometimes it affects 30% for each core

    CPU0%=0                  CPU0%=30%                   CPU0%=0
    CPU1%=100%       or      CPU0%=30%            or     CPU0%=0
    CPU2%=0                  CPU0%=30%                   CPU0%=0
    CPU3%=0                  CPU0%=30%                   CPU0%=100%

  • Multi host Container communication with kubernetes and flannel
  • creating new SSH keys during docker run
  • Error while running the ASP.NET Core WebApp on Docker in Windows 7 (Debugging)
  • Unable to build Dockerfile Error: Unable to access jarfile /dev/docker-files/billing/wlp-extended-
  • ADD Command for Docker Toolbox on Mac
  • How to view GUI apps from inside a docker container
  • One Solution collect form web for “docker run –cpuset is not having any effect”

    gzip does not use multiple cores even if they are available. As a result this program is not well suited to do performance tests regarding the use of CPU cores.

    Use pzip instead. see Utilizing multi core for tar+gzip/bzip compression/decompression

    Also see How can I produce high CPU load on a Linux server?

    conveniently the stress tool is already available on the Docker Hub, so you can verify that the docker --cpuset-cpus option is working correctly by running:

    docker run --rm -it --cpuset-cpus="0-3" jess/stress --cpu 4

    → you will witness that all 4 cores go to 100% usage.

    then by running:

    docker run --rm -it --cpuset-cpus="0-1" jess/stress --cpu 4

    → you will witness that just 2 cores go to 100% usage.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.