LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Find out the total memory a certain user's processes are using (https://www.linuxquestions.org/questions/linux-enterprise-47/find-out-the-total-memory-a-certain-users-processes-are-using-4175712610/)

mrkey 05-25-2022 04:35 PM

Find out the total memory a certain user's processes are using
 
I have a Redhat 7.9 with 16GB of RAM and 8GB of Swap and because I got Swap full notifications, I would like to know how much memory does the ora user's processes are using at a certain time.

Right now, the swap is pretty ok but still being used even if the Mem is showing 1451 from 15875 being used.
Code:

free -m
              total        used        free      shared  buff/cache  available
Mem:          15875        1451        8152        5700        6272        8595
Swap:          8191        2614        5577

Now I was able to run this fancy ps command and get the memory used by the processes of every user:

Code:

ps aux | awk '{arr[$1]+=$4}; END {for (i in arr) {print i,arr[i]}}' | sort -k2
Now I have some questions about the result.

When running ps aux I see that some process are using 0.0% Mem so I assume this is a roundup for something like 0.033% so not as accurate as I would like to be. Is there a way to be more 100% accurate?

My ora user got 101.3 and that's % of RAM - so does that mean that it was using all 100% of the 16GB and some more 1.3% from the Swap?

Why do I see 1451 of RAM currently being used if the ps aux is showing that ora's processes are using more than 100% of memory.

And why is Swap being used if only a small portion of RAM is used?

syg00 05-25-2022 05:25 PM

Accounting for memory usage is a black art, not a science. Anyone claiming 100% accounting is fooling themselves. Have a read of this for a tool that gives simple accurate results.


All times are GMT -5. The time now is 12:36 PM.