Re: A question about memory usage

From: Adam Tauno Williams <adamtaunowilliams(at)gmail(dot)com>
To: "pgsql-admin(at)postgresql(dot)org" <pgsql-admin(at)postgresql(dot)org>
Subject: Re: A question about memory usage
Date: 2007-06-12 17:46:07
Message-ID: 1181670367.5493.16.camel@aleph.whitemice.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

> I have a server with 4GB of RAM and I wanted to know how much memory
> is being used by a PostgreSQL. To do so I have executed the following:
> ps -A -o rss,vsz,command|grep postgres | awk '{rss += $1; vsz += $2 }
> END { print "Real: ",rss/1024"MB Virtual: ",vsz/1024"MB" }'
> And the result is:
> Real: 157.59MB Virtual: 6359.04MB
> So I understand that amount of virtual memory must be swapped to disk as
> it's bigger that my physical memory. To check this I have executed the
> free command and I get the following results:
> total used free shared buffers cached
> Mem: 4153180 3988536 164644 0 161400 3117900
> -/+ buffers/cache: 709236 3443944
> Swap: 6215672 64 6215608
> So my question is, what I'm doing wrong? because the swap it's almost
> empty

You are misunderstanding what these numbers mean on a UNIX system.

For starters -
http://virtualthreads.blogspot.com/2006/02/understanding-memory-usage-on-linux.html

And if you are not swapping, and your OS's cache is that huge, why
bother?

Use "ipcs" to display the allocation of shared memory.

--
Adam Tauno Williams, Network & Systems Administrator
Consultant - http://www.whitemiceconsulting.com
Developer - http://www.opengroupware.org

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Joost Kraaijeveld 2007-06-13 05:44:12 psql : Error: Cannot stat /pgdata/8.2/main
Previous Message Arnau 2007-06-12 17:26:56 A question about memory usage