Thread: Swapping

Swapping

From
Carlos Henrique Reimer
Date:
Hi,
 
I´m trying to tune a linux box with a 12 GB database and 4 GB RAM. First of all I would like to stop the swapping, so the shared_buffers and sort_mem were decreased but even so it started swapping two hours after DBMS started up.
 
I would like to know some suggestions how to discover why is it swapping?
 
I´ve collected the following data from the environment and saved at http://paginas.terra.com.br/educacao/rei/dados.htm
 
1. select version()
2. uname -a
3. cat /proc/cpuinfo
4. cat /proc/meminfo
5. vmstat 5
6. pg_stat_activity
7. postgresql.conf
 
Thanks in advance!
 
Reimer

__________________________________________________
Converse com seus amigos em tempo real com o Yahoo! Messenger
http://br.download.yahoo.com/messenger/

Re: Swapping

From
Tom Lane
Date:
Carlos Henrique Reimer <carlosreimer@yahoo.com.br> writes:
> I would like to know some suggestions how to discover why is it swapping?

Zero swap-in rate and swap-out rates in the single digits do not
constitute a swapping problem.  It's reasonably likely that that
traffic isn't even coming from Postgres, but something else.
I'd say ignore it.

            regards, tom lane

Re: Swapping

From
Tobias Brox
Date:
[Carlos Henrique Reimer - Wed at 03:25:15PM -0300]
> I´m trying to tune a linux box with a 12 GB database and 4 GB RAM. First
> of all I would like to stop the swapping, so the shared_buffers and sort_mem
> were decreased but even so it started swapping two hours after DBMS started
> up.
>
> I would like to know some suggestions how to discover why is it swapping?

I agree with Tom Lane, nothing to worry about.  Swapping is not a problem
per se, aggressive swapping is a problem.  If you are absolutely sure you
want to ban all swapping, use "swapoff"?

I'd trust linux to handle swap/cache sensibly.  Eventually, become involved
with kernel hacking ;-)

--
Notice of Confidentiality: This email is sent unencrypted over the network,
and may be stored on several email servers; it can be read by third parties
as easy as a postcard.  Do not rely on email for confidential information.

Re: Swapping

From
Tobias Brox
Date:
[Tobias Brox - Wed at 09:22:17PM +0200]
> I'd trust linux to handle swap/cache sensibly.  Eventually, become involved
> with kernel hacking ;-)

Of course, there are also some files in /proc/sys/vm that you may want to
peek into, for tuning the swapping.  Particularly, at later 2.6-kernels (I'm
running 2.6.12) you have the file /proc/sys/vm/swappiness, where the number
should be some percentage.  I'm not completely sure how it works, but I
suppose that the higher you set it, the more likely it is to swap out
memory not beeing used.  I think the default setting is probably sane, but
you may want to google a bit about it.

--
Notice of Confidentiality: This email is sent unencrypted over the network,
and may be stored on several email servers; it can be read by third parties
as easy as a postcard.  Do not rely on email for confidential information.