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

Stainforth, Matthew (SD/DS) Matthew.Stainforth at gnb.ca
Wed Mar 17 13:02:18 UTC 2010


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 at redhat.com [mailto:redhat-list-
> bounces at redhat.com] 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 at gnb.ca>
> 
> > 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 at redhat.com [mailto:redhat-list-
> > > bounces at redhat.com] 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 at redhat.com?subject=unsubscribe
> > > https://www.redhat.com/mailman/listinfo/redhat-list
> >
> > --
> > redhat-list mailing list
> > unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> > https://www.redhat.com/mailman/listinfo/redhat-list
> >
> --
> redhat-list mailing list
> unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
> https://www.redhat.com/mailman/listinfo/redhat-list




More information about the redhat-list mailing list