Sunday, May 5, 2024
1
rated 0 times [  1] [ 0]  / answers: 1 / hits: 668  / 2 Years ago, wed, february 2, 2022, 2:42:43

Running Ubuntu Server 12.04, meminfo shows pretty much all memory utilized:



$ cat /proc/meminfo
MemTotal: 8173180 kB
MemFree: 139556 kB
Buffers: 1146204 kB
Cached: 3062088 kB
SwapCached: 28 kB
Active: 4181280 kB
Inactive: 2175224 kB
Active(anon): 1824800 kB
Inactive(anon): 329536 kB
Active(file): 2356480 kB
Inactive(file): 1845688 kB
Unevictable: 0 kB
Mlocked: 0 kB
SwapTotal: 11719380 kB
SwapFree: 11719068 kB
Dirty: 160 kB
Writeback: 0 kB
AnonPages: 2148472 kB
Mapped: 98200 kB
Shmem: 6128 kB
Slab: 1509448 kB
SReclaimable: 1463828 kB
SUnreclaim: 45620 kB
KernelStack: 4504 kB
PageTables: 37756 kB
NFS_Unstable: 0 kB
Bounce: 0 kB
WritebackTmp: 0 kB
CommitLimit: 15805968 kB
Committed_AS: 2828504 kB
VmallocTotal: 34359738367 kB
VmallocUsed: 295632 kB
VmallocChunk: 34359432032 kB
HardwareCorrupted: 0 kB
AnonHugePages: 0 kB
HugePages_Total: 0
HugePages_Free: 0
HugePages_Rsvd: 0
HugePages_Surp: 0
Hugepagesize: 2048 kB
DirectMap4k: 195904 kB
DirectMap2M: 8187904 kB


This was just after a few hours after reboot. The memory was rapidly consumed. When I run top, the first 5 entries look like this:



  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                                
20011 myuser 20 0 654m 406m 3584 S 2 5.1 3:38.71 ruby
1311 root 20 0 0 0 0 S 0 0.0 3:50.95 jbd2/sda3-8
20633 root 20 0 0 0 0 S 0 0.0 0:02.82 kworker/7:3
27547 myuser 20 0 17468 1492 1044 R 0 0.0 0:00.07 top
1 root 20 0 24728 2672 1380 S 0 0.0 0:01.28 init
2 root 20 0 0 0 0 S 0 0.0 0:00.00 kthreadd


So only ruby is currently utilizing memory.



I can break that down further between phusion passenger (a module for apache) and apache:



------ Passenger processes ------
PID VMSize Private Name
---------------------------------
4088 218.3 MB 0.3 MB PassengerWatchdog
4092 1271.8 MB 2.9 MB PassengerHelperAgent
4099 230.6 MB 1.0 MB PassengerLoggingAgent
7143 317.8 MB 90.3 MB Passenger RackApp: /home/mysite/public_html/store.mysite.com/current
14841 654.3 MB 414.2 MB Passenger RackApp: /home/mysite/public_html/staging.mysite.com/current
17393 718.3 MB 444.1 MB Passenger RackApp: /home/mysite/public_html/staging.mysite.com/current
20004 526.2 MB 231.3 MB Passenger RackApp: /home/mysite/public_html/staging.mysite.com/current
20011 654.1 MB 340.6 MB Passenger RackApp: /home/mysite/public_html/staging.mysite.com/current
20018 462.2 MB 150.9 MB Passenger RackApp: /home/mysite/public_html/staging.mysite.com/current
### Processes: 9
### Total private dirty RSS: 1675.62 MB


Apache workers:



lynx http://localhost/server-status

Total accesses: 4452 - Total Traffic: 19.3 MB
CPU Usage: u.31 s.21 cu0 cs0 - .000612% CPU load
.0524 requests/sec - 238 B/second - 4556 B/request
10 requests currently being processed, 5 idle workers

_WW_W__WWWW..W.W..._W...........................................
................................................................
................................................................
................................................................

$ ps aux | grep apache2 | grep -v pts | awk '{ tot += $6; procs += 1; print $2,$6,$11 } END { print "TOTAL: ",tot,"/",procs,"=",tot/procs }'
4084 23068 /usr/sbin/apache2
7089 13496 /usr/sbin/apache2
11074 13668 /usr/sbin/apache2
14848 13288 /usr/sbin/apache2
16562 13508 /usr/sbin/apache2
16565 13248 /usr/sbin/apache2
17527 13832 /usr/sbin/apache2
21656 13516 /usr/sbin/apache2
23567 13508 /usr/sbin/apache2
24407 13508 /usr/sbin/apache2
25506 13256 /usr/sbin/apache2
26736 13540 /usr/sbin/apache2
26742 13288 /usr/sbin/apache2
27526 13512 /usr/sbin/apache2
27729 13036 /usr/sbin/apache2
28198 13032 /usr/sbin/apache2
TOTAL: 224304 / 16 = 14019


As you can see, no way apache/phusion passenger are utilizing almost 8 gb of RAM. What could be going on here?


More From » memory-usage

 Answers
0

It may not be actual physically used RAM, but rather Disk Cache. Disk Cache is where any frequently used files are stored in RAM so they can easily be retrieved again quickly without needing to wait on the disk (which is way slower than waiting for RAM). You can usually tell how much RAM is actually used for apps using the second line of the freecommand.



Here's an example:



            total       used       free     shared    buffers     cached
Mem: 12925 1221 11704 35 32 468
-/+ buffers/cache: 720 12205
Swap: 0 0 0


In this example I am physically using 720MB of ram of my 13GB, but with disk cache this amounts to 1221MB total. After a while my RAM usage will increase because the disk cache will increase, but the actual app RAM usage may not.



I hope this better explains things.


[#25388] Thursday, February 3, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
hirtieve

Total Points: 207
Total Questions: 104
Total Answers: 114

Location: Cook Islands
Member since Thu, May 21, 2020
4 Years ago
;