Thursday, May 9, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 1520  / 3 Years ago, thu, august 5, 2021, 9:55:10

After reading a lot of different articles on the Internet I'm still confused about how to find exactly what is using my memory.


After upgrading to Ubuntu Server 21.10 from 20.04 my memory usage increased dramatically and I'm trying to find out what is responsible for that.


When I'm logging into the server there are some welcome stats that say: Memory usage: 65%.


When I run free -m I get:


               total        used        free      shared  buff/cache   available
Mem: 31881 20575 9669 162 1636 10680
Swap: 8191 0 8191

So far it matches. I understand that there is some confusion here and my actual free memory is free + buff/cache or something like that but then I found a command on the Internet that returns the sum of memory consumption of all processes:


$ echo $(ps -o rss= ax | tr '
' +) 0 | bc
5978056

That gives 5-6GB. It doesn't match with any value returned from free -m. The result of top sorted by memory column seems to confirm this:


top - 10:53:49 up 3 days, 13:28,  1 user,  load average: 0.11, 0.10, 0.09
Tasks: 451 total, 1 running, 438 sleeping, 0 stopped, 12 zombie
%Cpu(s): 0.2 us, 0.1 sy, 0.0 ni, 99.8 id, 0.0 wa, 0.0 hi, 0.0 si, 0.0 st
MiB Mem : 31881.4 total, 9791.5 free, 20453.8 used, 1636.1 buff/cache
MiB Swap: 8192.0 total, 8192.0 free, 0.0 used. 10801.7 avail Mem

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
3930 mssql 20 0 20.6g 1.1g 44584 S 2.0 3.4 116:22.67 sqlservr
3115 mysql 20 0 5336868 726652 19148 S 0.3 2.2 11:29.69 mariadbd
19021 www-data 20 0 438324 231656 169396 S 0.0 0.7 3:31.67 php-fpm8.0
3348 www-data 20 0 438112 231096 171232 S 0.0 0.7 3:52.81 php-fpm8.0
3349 www-data 20 0 436832 227820 168664 S 0.0 0.7 3:26.81 php-fpm8.0
3356 www-data 20 0 429292 223864 171360 S 0.0 0.7 3:59.62 php-fpm8.0
3354 www-data 20 0 427580 221492 170016 S 0.0 0.7 3:47.99 php-fpm8.0
3357 www-data 20 0 428052 221336 169144 S 0.0 0.7 3:51.86 php-fpm8.0
3355 www-data 20 0 427056 220772 170064 S 0.0 0.7 3:35.60 php-fpm8.0
3345 www-data 20 0 427080 220116 169212 S 0.0 0.7 3:51.67 php-fpm8.0
3365 www-data 20 0 425712 220024 171216 S 0.0 0.7 3:42.05 php-fpm8.0
19700 www-data 20 0 424868 218940 169908 S 0.0 0.7 3:39.68 php-fpm8.0
3363 www-data 20 0 423260 218804 171252 S 0.0 0.7 3:45.00 php-fpm8.0
3341 www-data 20 0 423184 217468 170044 S 0.0 0.7 3:49.10 php-fpm8.0
3353 www-data 20 0 421016 214860 169556 S 0.0 0.7 3:30.55 php-fpm8.0
3351 www-data 20 0 420432 212680 169256 S 0.0 0.7 3:25.20 php-fpm8.0
2674 www-data 20 0 22.7g 169652 41068 S 0.0 0.5 3:03.73 dotnet
2696 git 20 0 2181008 165396 43788 S 0.0 0.5 7:55.15 gitea
1324 root 19 -1 134508 72360 71296 S 0.0 0.2 0:15.71 systemd-journal
4159 root 20 0 2052028 62724 31824 S 0.0 0.2 4:02.05 dockerd
2289460 root 20 0 1910052 39892 20176 S 0.0 0.1 0:23.22 snapd
2726 root 20 0 2011284 31740 16344 S 0.0 0.1 8:44.13 containerd
2703 root 20 0 270968 26244 19164 S 0.0 0.1 0:23.63 php-fpm8.0
3251 www-data 20 0 102500 21180 16652 S 0.0 0.1 6:46.80 nginx
2734 root 20 0 1139124 20408 7864 S 0.3 0.1 14:21.22 fail2ban-server
3254 www-data 20 0 101948 20048 16336 S 0.0 0.1 0:02.27 nginx
4165 minidlna 20 0 239012 19372 14324 S 0.0 0.1 0:39.26 minidlnad
2017 root rt 0 280960 18584 8772 S 0.3 0.1 0:47.47 multipathd
2801 root 20 0 112464 18560 9988 S 0.0 0.1 0:00.05 unattended-upgr
4242 root 20 0 84880 17604 14660 S 0.0 0.1 0:15.41 smbd
2664 root 20 0 34740 17488 8508 S 0.0 0.1 0:00.08 networkd-dispat
3253 www-data 20 0 101372 17020 13748 S 0.0 0.1 0:00.18 nginx
203855 root 20 0 295244 16160 13364 S 0.0 0.0 0:02.36 packagekitd
2700 mssql 20 0 72632 14852 6224 S 0.0 0.0 0:00.85 sqlservr
3257 www-data 20 0 101240 14756 11540 S 0.0 0.0 0:00.02 nginx
4234 root 20 0 22436 12928 3544 S 0.0 0.0 0:10.19 ddclient - slee
4160 root 20 0 70756 12212 9912 S 0.0 0.0 0:09.06 nmbd
2676 root 20 0 395152 11632 8612 S 0.0 0.0 0:53.73 udisksd
2591 systemd+ 20 0 23640 11164 7108 S 0.0 0.0 1:26.88 systemd-resolve
1 root 20 0 166644 10784 5516 S 0.0 0.0 0:29.92 systemd
4561 root 20 0 26968 10156 7144 S 0.0 0.0 0:44.81 portainer
4288 root 20 0 84864 9184 6240 S 0.0 0.0 0:00.99 lpqd
1319978 rychu 20 0 15832 8848 6896 S 0.0 0.0 0:00.06 systemd
4284 root 20 0 82640 8748 5956 S 0.0 0.0 0:00.59 smbd-notifyd
3255 www-data 20 0 101088 8668 5496 S 0.0 0.0 0:00.00 nginx
2706 redis 20 0 70552 8420 6348 S 0.0 0.0 13:27.82 redis-server
1319928 root 20 0 14860 8112 6648 S 0.0 0.0 0:00.03 sshd
2671 root 20 0 126992 7576 6720 S 0.0 0.0 0:22.24 thermald

Here is my snap list output:


$ snap list
Name Version Rev Tracking Publisher Notes
canonical-livepatch 10.1.2 126 latest/stable canonical✓ -
core 16-2.54.3 12725 latest/stable canonical✓ core
core18 20211215 2284 latest/stable canonical✓ base
core20 20220114 1328 latest/stable canonical✓ base
lxd 4.0.8 21835 4.0/stable/… canonical✓ -

So I'm confused where does my ~14GB of used memory is?


More From » ram

 Answers
2

Your running processes seem to utilize ca. 18% of your memory.
And remaining usage could be ZFS ARC (basically up to 50% of system memory by default).
See Is ZFS on Ubuntu 20.04 using a ton of memory?


P.S. Don't look at “free” memory - in essence it is the memory that is unused. Consider this like 35% RAM of my computer is wasting now (so to say it's superfluous at the moment).



After upgrading to Ubuntu Server 21.10 from 20.04 my memory usage increased dramatically



Together with output of free and top it means only that 21.10 is able to utilize your memory better than 20.04, nothing else.


[#782] Thursday, August 5, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ticeate

Total Points: 497
Total Questions: 128
Total Answers: 112

Location: Samoa
Member since Fri, Nov 27, 2020
4 Years ago
ticeate questions
Sat, May 28, 22, 13:09, 2 Years ago
Thu, Jan 20, 22, 05:32, 2 Years ago
Sun, Mar 20, 22, 12:37, 2 Years ago
;