2007-11-13 07:09:17

by Al Boldi

[permalink] [raw]
Subject: top lies ?

kloczek wrote:
> Some data showed by top command looks like completly trashed.
> Fragment from top output:
>
> Mem: 2075784k total, 2053352k used, 22432k free, 19260k buffers
> Swap: 2096472k total, 136k used, 2096336k free, 1335080k cached
>
> PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP nFLT
> WCHAN COMMAND 14515 mysql 20 0 1837m 563m 4132 S 39 27.8
> 27:14.20 1.2g 18 - mysqld
>
> How it is possible that swap ussage is 136k and swapped out portion of (in
> this case) mysqld process is 1.2g ?

Welcome to OverCommit, aka OOM-nirvana.

Try this:
# echo 2 > /proc/sys/vm/overcommit_memory
# echo 0 > /proc/sys/vm/overcommit_ratio

But make sure you have enough swap.


Thanks!

--
Al


2007-11-13 07:19:26

by Balbir Singh

[permalink] [raw]
Subject: Re: top lies ?

On Nov 13, 2007 12:38 PM, Al Boldi <[email protected]> wrote:
> kloczek wrote:
> > Some data showed by top command looks like completly trashed.
> > Fragment from top output:
> >
> > Mem: 2075784k total, 2053352k used, 22432k free, 19260k buffers
> > Swap: 2096472k total, 136k used, 2096336k free, 1335080k cached
> >
> > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP nFLT
> > WCHAN COMMAND 14515 mysql 20 0 1837m 563m 4132 S 39 27.8
> > 27:14.20 1.2g 18 - mysqld
> >
> > How it is possible that swap ussage is 136k and swapped out portion of (in
> > this case) mysqld process is 1.2g ?
>
> Welcome to OverCommit, aka OOM-nirvana.
>
> Try this:
> # echo 2 > /proc/sys/vm/overcommit_memory
> # echo 0 > /proc/sys/vm/overcommit_ratio
>
> But make sure you have enough swap.
>
>
> Thanks!

The swap cache looks pretty big, may be top is including that data
while reporting swap usage.

Balbir

2007-11-13 07:42:16

by Al Boldi

[permalink] [raw]
Subject: Re: top lies ?

Balbir Singh wrote:
> On Nov 13, 2007 12:38 PM, Al Boldi <[email protected]> wrote:
> > kloczek wrote:
> > > Some data showed by top command looks like completly trashed.
> > > Fragment from top output:
> > >
> > > Mem: 2075784k total, 2053352k used, 22432k free, 19260k
> > > buffers Swap: 2096472k total, 136k used, 2096336k free,
> > > 1335080k cached
> > >
> > > PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ SWAP nFLT WCHAN COMMAND
> > > 14515 mysql 20 0 1837m 563m 4132 S 39 27.8 27:14.20 1.2g 18 - mysqld
> > >
> > > How it is possible that swap ussage is 136k and swapped out portion of
> > > (in this case) mysqld process is 1.2g ?
> >
> > Welcome to OverCommit, aka OOM-nirvana.
> >
> > Try this:
> > # echo 2 > /proc/sys/vm/overcommit_memory
> > # echo 0 > /proc/sys/vm/overcommit_ratio
> >
> > But make sure you have enough swap.
> >
> >
> > Thanks!
>
> The swap cache looks pretty big, may be top is including that data
> while reporting swap usage.

I don't think so. top reports correctly, it's the VM that is lying.
I guess you can tell what happens when push comes to shove...


Thanks!

--
Al