Re: newbie question about memory
- From: Jean-David Beyer <jeandavid8@xxxxxxxxxxx>
- Date: Sat, 28 Apr 2007 14:12:16 GMT
Sergei Shelukhin wrote:
Hi. I am a database prorgammer and I work on windows/MSSQL or with
small MySql databases 90% of the time, however on a project that is on
the way now, I have to use PostgreSQL on Linux; moreover, I need to
configure the server.
So, as I was figuring out the amount of memory on the server that I
can grab for db server operations, I stumbled upon an interesting
thing.
According to cat /proc/meminfo, I have 2 Gb of memory and 500Mb are
free.
My box has 8 GBytes RAM, and right now about 21 Megabytes are free. The
machine is not doing much; in particular, no database operations are being
done (although some of the daemons are running).
Now the database is very big, but it's not operating it, so I was
surprised to see such a high memory use.
In Linux, the philosophy is that there is no point in having a lot of free
memory, so the system uses the "excess" for caching recently read pages in
case they are needed again. I have so much memory that it could cache entire
programs so they would load faster if I run them again soon enough.
I checked ps -eo user,comm,%mem, and memory percents total to about
1.2% 0_o I see a lot of fancy labels in meminfo output, cached, etc,
but I cannot figure out what they mean and google seems
uncooperative :)
I have two questions
1) Where did the memory go?
On my system, about 660 Megabytes are used for (output) buffers and about 6
GBytes are used for (input) cache.
2) Can it be freed e.g. can I safely assume that I have 1-1.5Gb forI do not think you can explicitly free it, but the kernel will grab as much
PostgreSQL to roam free?
cache as it needs. It may also get buffer space although that may cost more
(as it may need to be written out first).
I do not know how postgreSQL is designed. I run IBM's DB2. It does its own
IO in raw mode (i.e., it uses the kernel drivers, but not the file system),
making the stuff contiguous on disk, and using much larger page sizes that
are typical in Linux. I have set up my kernel to allow each process to use 4
GBytes of RAM (instead of the usual 3 GBytes) (which does not make sense
unless you have more than 4 GBytes of RAM, IMAO). And I have set DB2 to have
a buffer pool for the index of around 4 GBytes. My hope is to get the entire
index of my database (well, only the hot parts, actually) to speed things
up. It is now tuned so that the bottleneck is the speed of writing the
logfiles (I am going to replace the 7200rpm IDE hard drive with a 10,000 rpm
SCSI drive on a different SCSI controller from the other database drives to
speed this up, although I do not know how much I will get from that.)
Anyway, you can know how much memory you will really need for this. I would
worry that 2 GBytes may not be enough. While you could allocate a large
enough swap partition to run, if you actually use it much, the paging rate
may make the system insufficiently responsive. So try to find out how much
memory you will actually need and then try to have at least that much.
My machine permits 16 GBytes, but my wallet did not.
--
.~. Jean-David Beyer Registered Linux User 85642.
/V\ PGP-Key: 9A2FC99A Registered Machine 241939.
/( )\ Shrewsbury, New Jersey http://counter.li.org
^^-^^ 09:55:01 up 70 days, 21:23, 3 users, load average: 4.49, 4.18, 4.12
.
- References:
- newbie question about memory
- From: Sergei Shelukhin
- newbie question about memory
- Prev by Date: Cure from vitiligo
- Next by Date: Re: Accidental deletion. Help please!
- Previous by thread: Re: newbie question about memory
- Next by thread: Globe7 has Launched new VOIP! Phone for linux users
- Index(es):
Relevant Pages
|