Very high CPU usage (compared with docker stats)Add

Hello,
I’m a bit astonished by the differences between CPU usage in unix top command and CPU usage in docker stats. I know that docker stats doesn’t count CPU usage of docker daemon itself, but the difference is so important.

docker stats

CONTAINER ID        NAME                     CPU %               MEM USAGE / LIMIT     MEM %               NET I/O             BLOCK I/O           PIDS
980f8197b7a4        traefik-proxy            1.50%               19.07MiB / 3.858GiB   0.48%               126MB / 130MB       19.4MB / 81.9kB     17
bbdb85d87e19        postgres_ext             0.79%               3.406MiB / 3.858GiB   0.09%               767kB / 1.87MB      2.25GB / 17.1MB     8
96875ed2751c        container-php             0.00%               8.82MiB / 3.858GiB    0.22%               1.23MB / 652kB      30.4MB / 0B         3
4adbdc1f00d5        container-mediawiki       0.00%               18.23MiB / 3.858GiB   0.46%               3.97MB / 1.25MB     84.9MB / 2.11MB     7
5863404acfbe        container-nginx           0.32%               1.734MiB / 3.858GiB   0.04%               31.6MB / 169MB      205MB / 0B          2
57f48d070804        container2-nginx      0.00%               2.441MiB / 3.858GiB   0.06%               2.26MB / 9.87MB     20.1MB / 0B         2
52794d154062        container-postgres        0.00%               1.625MiB / 3.858GiB   0.04%               1.85kB / 0B         16.8MB / 401kB      6
1def99fe7c92        container2-php        0.00%               7.527MiB / 3.858GiB   0.19%               1.61MB / 442kB      18.6MB / 0B         3
1ac98ea7b17c        container-mariadb         0.03%               168.3MiB / 3.858GiB   4.26%               58kB / 1.1MB        213MB / 31.6MB      32
682c37718db0        container2-mariadb    0.01%               87.92MiB / 3.858GiB   2.23%               236kB / 4.53MB      90.7MB / 41.5MB     30
baaa39931a5c        container2-postgres   0.01%               1.527MiB / 3.858GiB   0.04%               1.53kB / 0B         15.6MB / 401kB      6
d8f284c438af        container2-php5       0.00%               21.37MiB / 3.858GiB   0.54%               4.62MB / 2.02MB     72.4MB / 0B         4
d8035fd66102        container-php5            0.28%               5.043MiB / 3.858GiB   0.13%               13.3MB / 4.17MB     9.31MB / 0B         4
d65050511747        container_vsftpd               0.00%               1.379MiB / 3.858GiB   0.03%               4.75kB / 2.61kB     50.1MB / 287kB      2
315ea21c999f        logspout_logspout_1      0.03%               5.145MiB / 3.858GiB   0.13%               1.28kB / 422B       0B / 0B             8

So i have one traefik container, four PHP containers, 2 mariadb containers, 3 postgres containers. They don’t seem to use a lot of resources ! (RAM or CPU).

top

top - 15:39:31 up  2:57,  2 users,  load average: 8,14, 7,71, 7,72
Tasks: 315 total,   1 running, 314 sleeping,   0 stopped,   0 zombie
%Cpu0  : 81,9 us,  4,7 sy,  0,0 ni, 13,0 id,  0,0 wa,  0,0 hi,  0,3 si,  0,0 st
%Cpu1  : 88,7 us,  2,3 sy,  0,0 ni,  9,0 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
%Cpu2  : 80,6 us,  6,0 sy,  0,0 ni, 13,0 id,  0,0 wa,  0,0 hi,  0,3 si,  0,0 st
%Cpu3  : 85,5 us,  2,7 sy,  0,0 ni, 11,4 id,  0,0 wa,  0,0 hi,  0,3 si,  0,0 st
%Cpu4  : 82,1 us,  4,4 sy,  0,0 ni, 13,5 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
%Cpu5  : 88,6 us,  3,0 sy,  0,0 ni,  8,4 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
%Cpu6  : 82,7 us,  5,4 sy,  0,0 ni, 11,9 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st
%Cpu7  : 84,8 us,  3,7 sy,  0,0 ni, 11,1 id,  0,0 wa,  0,0 hi,  0,3 si,  0,0 st
KiB Mem :  4045612 total,   542052 free,   639448 used,  2864112 buff/cache
KiB Swap:  3149820 total,  3066508 free,    83312 used.  2914132 avail Mem 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU %MEM     TIME+ COMMAND                                                                                                        
15941 root      20   0 2050700  87724  29156 S 673,4  2,2 284:46.21 dockerd                                                                                                        
15952 root      20   0 1534388  21188   3956 S   5,3  0,5   1:24.11 docker-containe                                                                                                
11372 root      20   0   66512  34776  15860 S   2,3  0,9   0:16.43 traefik                                                                                                        
18314 mustsys+  20   0  489776  25172  13888 S   2,0  0,6   0:05.56 docker                                                                                                         
    7 root      20   0       0      0      0 S   0,3  0,0   0:12.25 rcu_sched                                                                                                      
  477 root      20   0       0      0      0 S   0,3  0,0   0:01.08 jbd2/dm-0-8                                                                                                    
 8521 82        20   0   61404   6708   2800 S   0,3  0,2   0:01.33 php-fpm                                                                                                        
 8522 82        20   0   61404   6316   2408 S   0,3  0,2   0:01.32 php-fpm                                                                                                        
18042 root      20   0  413704   3768   2356 S   0,3  0,1   0:07.01 docker-containe                                                                                                
18982 systemd+  20   0   37456   2320    752 S   0,3  0,1   0:12.18 nginx                                                                                                          
20254 mustsys+  20   0   40656   3940   3160 R   0,3  0,1   0:00.05 top                                                                                                            
    1 root      20   0   37952   5108   3324 S   0,0  0,1   0:07.56 systemd                                                                                                        
    2 root      20   0       0      0      0 S   0,0  0,0   0:00.00 kthreadd                                                                                                       
    3 root      20   0       0      0      0 S   0,0  0,0   0:00.27 ksoftirqd/0             

It’s a VM on a ESXi, with 8 CPU vCore and 4GB of RAM.VMWare ESXi tells me that my VM is using 11,3GHZ of CPU :’(

Do you have an idea what way cause this ?

I use last docker version (17.10).

Thank you a lot