LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Enterprise (https://www.linuxquestions.org/questions/linux-enterprise-47/)
-   -   Memory Usage (https://www.linuxquestions.org/questions/linux-enterprise-47/memory-usage-585365/)

ajatiti 09-17-2007 03:52 PM

Memory Usage
 
Hi,

We have RHEL4 and application running on it.

I have been collecting the output of "free" command to keep an eye on the memory usage. I can see that there was a drastic change in the memory usage. See the ouput below it hsows the used memory drops from 11GB to 1.8GB. Why is that so?

Thu Sep 13 10:10:10 PDT 2007
total used free shared buffers cached
Mem: 12302400 11901760 400640 0 237668 4866208
-/+ buffers/cache: 6797884 5504516
Swap: 1769464 0 1769464
Thu Sep 13 10:20:10 PDT 2007
total used free shared buffers cached
Mem: 12302400 1816972 10485428 0 237344 887920
-/+ buffers/cache: 691708 11610692
Swap: 1769464 0 1769464

Thanks,
Ajatiti

ChrisScott 09-18-2007 02:57 PM

It might be useful to know which process are using your memory up!

Try something like:

Code:

ps --no-headers -eo size,cmd,pid |sort -n |tail -10
After using free to find the 10 biggest footprints....

ajatiti 09-19-2007 08:37 AM

Thank you ChrisScott,

After running that command I found there is a process taking highest memory of 711MB.

Still I have more Q - why does the size of used memory on the server get on increasing? If I sum up the memory used by all the processes in ps command, it doesn't equal to the used memory shown using free command.
Who is using the remaining memory? and why does it(total used memory) suddenly become very less?

Thanks,
Ajay

ech310n 09-19-2007 05:03 PM

Hi,

We too have seen similar behaviour on RHEL4 systems. This seems to be down to the way linux uses available memory to speed up I/O by allocating it to cache. If you look, where you have a smaller amount of free RAM, you will notice the cache value has increased. This is normal behvaiour, and as RAM is needed to execute processes it is taken away from cache and realocated accordingly. Linux tries to make the best use it can of all available RAM. There was a big problem with this in RHEL3 Update 3 and below however where a kernel parameter /proc/sys/vm/pagecache) was set such that the system could potentially allocate 100% of RAM to cache, and thus start swapping out active processes which would eventually result in the system hanging, but I think the management of this is handled much better in RHEL4 with the 2.6 kernel.

Hope that helps.

ajatiti 09-20-2007 09:36 AM

Thanks ech310n,

So in this case:

Thu Sep 13 10:10:10 PDT 2007
total used free shared buffers cached
Mem: 12302400 11901760 400640 0 237668 4866208
-/+ buffers/cache: 6797884 5504516
Swap: 1769464 0 1769464

What is the actual memory used by the above Server?


Thanks,
Ajay

ajatiti 09-25-2007 10:06 AM

Any Ideas?

rmitev 10-07-2007 06:44 AM

Code:

Thu Sep 13 10:10:10 PDT 2007
        total        used    free  shared  buffers  cached
Mem: 12302400    11901760  400640        0    237668  4866208
-/+ buffers/cache: 6797884  5504516
Swap: 1769464            0  1769464

free (+buff/cache) = 5504516
cached= 4866208

for more
Code:

cat /proc/meminfo

rmitev 10-07-2007 06:51 AM

Code:

Thu Sep 13 10:20:10 PDT 2007
        total      used      free  shared  buffers    cached
Mem:  12302400    1816972  10485428        0    237344    887920
-/+ buffers/cache: 691708  11610692
Swap: 1769464          0  1769464

do you run a program that needs a lot of memory ( for example open a 1 GB archive in midnight commander (mc) ...)

run
Code:

top
on a separate console and sort processes by memory usage (M - key) ... work on 1 and see what happens at top-s console ...


All times are GMT -5. The time now is 04:28 AM.