Sunday, October 6, 2019

docker - How much of my memory is actually used?

I have a VPS with 8 GB of memory running mainly docker containers.



When I go to the cloud monitoring service provided by my provider, I see that ~10% of the RAM is used.




I don't understand how this value is related to the output of the three following commands (I have put the outputs of these at the end of my question):



$ free -mh
$ top
$ docker stats


Could someone explain me why free -mh tells me that I am using 7.5/7.8GB of memory, while my VPS tells me I am only using 10%, and the values given by the top command do not make sense to me?







free



free -mh
total used free shared buffers cached
Mem: 7.8G 7.5G 275M 144M 348M 2.3G
-/+ buffers/cache: 4.9G 3.0G
Swap: 1.9G 454M 1.5G



docker stats



docker stats --no-stream
CONTAINER CPU % MEM USAGE / LIMIT MEM % NET I/O BLOCK I/O PIDS
496ec398b3f9 0.09% 2.285 MiB / 7.812 GiB 0.03% 648 B / 648 B 40.96 kB / 0 B 0
e8d13a2df058 0.07% 674.2 MiB / 7.812 GiB 8.43% 196.4 kB / 252.3 kB 10.43 MB / 364.5 kB 0
87f43f54f772 0.01% 276.8 MiB / 7.812 GiB 3.46% 7.396 MB / 7.802 MB 71.07 MB / 0 B 0
6a9039c835ad 3.49% 885.1 MiB / 7.812 GiB 11.06% 150.6 kB / 20.93 MB 124.9 MB / 138.7 MB 0
5f56a4113665 0.91% 1014 MiB / 7.812 GiB 12.67% 2.681 GB / 368.8 MB 197.2 MB / 17.56 MB 0
8dabe37320f9 0.10% 3.762 MiB / 7.812 GiB 0.05% 270.1 MB / 213.4 MB 249.9 kB / 3.883 MB 0

57f6c6b96e72 0.34% 39.24 MiB / 7.812 GiB 0.49% 58.84 MB / 67.32 MB 6.246 MB / 4.649 MB 0
738e3d84e9d4 0.00% 3.562 MiB / 7.812 GiB 0.04% 1.048 GB / 1.045 GB 1.155 MB / 0 B 0
17704ca17a93 0.00% 49.04 MiB / 7.812 GiB 0.61% 271.8 MB / 1.484 GB 83.34 MB / 0 B 0
3beefb4fd14a 0.04% 31.12 MiB / 7.812 GiB 0.39% 342.5 kB / 875.2 kB 5.235 MB / 69.63 kB 0
4035cf7f0af5 0.04% 68.16 MiB / 7.812 GiB 0.85% 215.2 MB / 672.8 MB 148.9 MB / 16.09 GB 0
4fba55aa76a4 0.05% 42.61 MiB / 7.812 GiB 0.53% 147.5 kB / 19.09 kB 167 MB / 24.58 kB 0
83571a1747cb 0.00% 8.207 MiB / 7.812 GiB 0.10% 25.23 MB / 20.19 MB 13.8 MB / 8.192 kB 0


top




top # Sorted by memory usage

top - 10:14:19 up 20 days, 17:27, 1 user, load average: 0.36, 0.43, 0.47
Tasks: 284 total, 1 running, 283 sleeping, 0 stopped, 0 zombie
%Cpu(s): 1.0 us, 0.4 sy, 0.0 ni, 98.5 id, 0.1 wa, 0.0 hi, 0.0 si, 0.0 st
KiB Mem: 8191140 total, 7896220 used, 294920 free, 356984 buffers
KiB Swap: 1998844 total, 465312 used, 1533532 free. 2449876 cached Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND

8034 systemd+ 20 0 711.4m 469.8m 2.7m S 0.0 5.9 0:00.00 clamd
43964 998 20 0 712.7m 369.3m 8.1m S 1.7 4.6 144:06.61 bundle
44897 998 20 0 688.2m 226.1m 7.1m S 0.0 2.8 0:03.19 bundle
44895 998 20 0 507.8m 194.5m 6.9m S 0.0 2.4 0:02.27 bundle
46409 www-data 20 0 3728.6m 167.0m 4.7m S 0.0 2.1 10:42.66 node
43885 998 20 0 505.8m 158.7m 6.8m S 0.0 2.0 0:46.59 bundle
8058 Debian-+ 20 0 230.3m 114.9m 6.4m S 0.0 1.4 0:00.72 /usr/sbin/amavi
8057 Debian-+ 20 0 228.7m 113.3m 6.4m S 0.0 1.4 0:00.22 /usr/sbin/amavi
8052 Debian-+ 20 0 227.0m 112.1m 5.5m S 0.0 1.4 0:01.21 /usr/sbin/amavi
46410 www-data 20 0 998.3m 105.9m 4.5m S 0.0 1.3 9:20.22 node

46418 www-data 20 0 983.0m 95.9m 6.1m S 0.0 1.2 0:51.50 node
46415 www-data 20 0 993.0m 80.7m 4.2m S 0.0 1.0 0:19.56 node
46400 www-data 20 0 974.3m 78.4m 4.3m S 0.3 1.0 60:12.96 node
46402 www-data 20 0 991.1m 76.0m 4.7m S 0.0 1.0 0:20.13 node
46414 www-data 20 0 990.3m 75.7m 4.0m S 0.0 0.9 0:58.40 node
46411 www-data 20 0 971.2m 74.5m 3.9m S 0.0 0.9 7:59.44 node
46398 www-data 20 0 985.9m 71.8m 4.0m S 0.0 0.9 0:18.67 node
46408 www-data 20 0 957.8m 64.1m 3.6m S 0.0 0.8 8:40.84 node
311 mikael 20 0 636.8m 63.0m 57.4m S 0.0 0.8 0:00.18 php-fpm7.1
46413 www-data 20 0 1754.8m 52.8m 3.3m S 0.0 0.7 0:01.27 node

550 root 20 0 1872.5m 52.0m 19.7m S 0.0 0.7 96:58.89 dockerd
1415 999 20 0 966.3m 48.6m 4.9m S 0.0 0.6 19:56.53 mysqld
322 mikael 20 0 646.2m 47.1m 31.0m S 0.0 0.6 0:04.53 php-fpm7.1
321 mikael 20 0 646.2m 46.7m 30.8m S 0.0 0.6 0:05.11 php-fpm7.1
360 mikael 20 0 643.8m 44.4m 31.0m S 0.0 0.6 0:03.86 php-fpm7.1
13400 999 20 0 937.7m 34.0m 3.9m S 0.0 0.4 12:39.05 mysqld
30467 999 20 0 344.9m 25.6m 4.6m S 0.0 0.3 38:51.77 mongod
44940 996 20 0 59.1m 21.7m 7.7m S 0.0 0.3 0:00.14 postgres



Some commands outputs



$ uname -a
Linux domain.com 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30) x86_64 GNU/Linux

$ docker version
Client:
Version: 1.12.6
API version: 1.24
Go version: go1.6.4

Git commit: 78d1802
Built: Tue Jan 10 20:17:57 2017
OS/Arch: linux/amd64

Server:
Version: 1.12.6
API version: 1.24
Go version: go1.6.4
Git commit: 78d1802
Built: Tue Jan 10 20:17:57 2017

OS/Arch: linux/amd64

$ virt-what
vmware

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...