RE: confused with memory usage, sar, top, free, vmstat



Yes, extra memory will be used in buffers and cache, and that memory can be reclaimed if needed.

No matter how much extra memory you have, the kernel will page out some infrequently accessed memory pages to swap space. There are debates over whether that is good. You can control the behavior to some extent using /proc/sys/vm/swappiness.

Here is a link that might be helpful:

http://kerneltrap.org/node/3000

-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx [mailto:redhat-list-
bounces@xxxxxxxxxx] On Behalf Of ESGLinux
Sent: Wednesday, March 17, 2010 9:29 AM
To: General Red Hat Linux discussion list
Subject: Re: confused with memory usage, sar, top, free, vmstat

Hi Matthew, thanks for your answer.

so, when this tools say that the memused is 3,4G this is true but with
the
detail that the amount allocated in buffers y cache are avaliable to
use,
isnt it?

one finally doubt is about swap, Why I have an 8% of swap if I really
have a
lot of free mem?

Well, with this I think I can tell my boss that we don´t need to buy
more
mem ;-)

Greetings,

ESG


2010/3/17 Stainforth, Matthew (SD/DS) <Matthew.Stainforth@xxxxxx>

Is is fine. The output of sar, free, top, and vmstat are all
agreeing that
you have about 3.4GB mem used (~82%) with about 750MB free.

The kbbuffers and kbcached from sar agrees with buffers (.48 GB) and
cached
(.56 GB) from free. The buff and cached from vmstat also agrees.

Now if you look at the -/+ buffers/cache line from free, you will see
that
you really only have 2.36GB used and 1.78GB free if you don't count
buffers
and cache. 2.36GB + .48GB + .56GB = 3.4GB used.

So you have about a gig of memory tied up in buffers and cache that
could
be freed if needed by the system.

Further, you only have 40MB (8%) of swap used. If you were starved
for
memory this would be higher and your cache and buffers would be
lower.

-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx [mailto:redhat-list-
bounces@xxxxxxxxxx] On Behalf Of ESGLinux
Sent: Wednesday, March 17, 2010 5:44 AM
To: General Red Hat Linux discussion list
Subject: confused with memory usage, sar, top, free, vmstat

Hi all,

I have a server that I think is having problems with memory usage
but
when I
try to analize with different tools I´m not sure if I having
problems
with
it

If I run sar -r:
...
04:50:01 kbmemfree kbmemused %memused kbbuffers kbcached
kbswpfree
kbswpused %swpused kbswpcad
09:05:01 748036 3401232 81,97 448672
599232
3768868 327664 8,00 40456
09:10:01 749596 3399672 81,93 480028
560856
3768868 327664 8,00 40456
09:15:01 749020 3400248 81,95 481144
559740
3768868 327664 8,00 40456
09:20:01 749516 3399752 81,94 481812
559332
3768868 327664 8,00 40456
09:25:01 749676 3399592 81,93 481928
559216
3768868 327664 8,00 40456
...

free
total used free shared
buffers cached
Mem: 4149268 3407624 741644 0 481084
566300
-/+ buffers/cache: 2360240 1789028
Swap: 4096532 327664 3768868

vmstat 1
procs -----------memory---------- ---swap-- -----io---- --system--
----cpu----
r b swpd free buff cache si so bi bo in cs
us
sy id
wa
0 0 327664 741412 481444 566200 1 1 10 56 0 2
2
1 96
1
0 0 327664 741412 481452 566192 0 0 0 24 1017 880
1
0 99
1
0 0 327664 741428 481460 566184 0 0 0 60 1012 812
0
0 99
1
0 0 327664 741428 481460 566184 0 0 0 0 1008 835
0
0 100
0
2 1 327664 741428 481464 566180 0 0 0 12 1020 859
0
0 100
0

top -b -d 1 -n 1
top - 09:37:02 up 141 days, 20:15, 1 user, load average: 0.00,
0.02,
0.03
Tasks: 115 total, 1 running, 114 sleeping, 0 stopped, 0
zombie
Cpu(s): 1.6% us, 0.6% sy, 0.2% ni, 96.4% id, 1.2% wa, 0.0% hi,
0.0% si
Mem: 4149268k total, 3408280k used, 740988k free, 481752k
buffers
Swap: 4096532k total, 327664k used, 3768868k free, 566152k
cached

I have read that linux try to allocate all the RAM memory, so the
real
free
memory is the free + buffers/cache, is it true? if so, the %memused
shown by
sar -r is not true?

Can anybody give a light to understand this (docs, tools...)? with
the
commands I have post do you think that I´m having problems with the
memory
or can I be calm?

Thanks in advance

ESG
--
redhat-list mailing list
unsubscribe mailto:redhat-list-
request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list



Relevant Pages

  • Re: svn - but smaller?
    ... Such buffers exist during the entire program's lifetime even if they ... rather than just having a gigantic portion of memory allocated ... limits of the underlying application. ... larger than 2048 might warrant use of malloc. ...
    (freebsd-stable)
  • Re: confused with memory usage, sar, top, free, vmstat
    ... the resource your boss will buy today may be the resource that is needed ... The kbbuffers and kbcached from sar agrees with buffers and ... memory this would be higher and your cache and buffers would be lower. ... confused with memory usage, sar, top, free, vmstat ...
    (RedHat)
  • Re: problems with mmap() and disk caching
    ... inactive shows disk cache and wired shows kernel itself. ... Active memory: the memory which is referenced by application. ... The pages migrate between active/inactive/cache/free by the ... On buffers dissolve, buffer cache explicitely puts pages constituing ...
    (freebsd-hackers)
  • Re: New Forum: BulletProof, Bitmap Steganography, XOR
    ... I see no reason for the great speed differencies, it's my system disk, ... the huge speed loss when switching from 0.5MB to 1MB buffers). ... cache is the issue. ... That's why I used such a large file, my memory is only 8GB with half ...
    (sci.crypt)
  • Re: problems with mmap() and disk caching
    ... Now the file is in inactive memory, ... inactive shows disk cache and wired shows kernel itself. ... Any managed mapping of the page participates in the active references. ... On buffers dissolve, buffer cache explicitely puts pages constituing ...
    (freebsd-hackers)