Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 31 Dec 2010 10:06:13 +0100
From:      Nicolas Haller <nicolas.haller@corp.nerim.fr>
To:        Jim Nasby <jim@nasby.net>
Cc:        freebsd-performance@freebsd.org
Subject:   Re: tunning disk cache for pgsql?
Message-ID:  <20101231090612.GN2660@baneblade.noc.nerim.net>
In-Reply-To: <AABD98FE-DA25-4A09-86D6-EBC341040A35@nasby.net>
References:  <20101228135940.GE2660@baneblade.noc.nerim.net> <AABD98FE-DA25-4A09-86D6-EBC341040A35@nasby.net>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Dec 30, 2010 at 06:15:34PM -0600, Jim Nasby wrote:
> On Dec 28, 2010, at 7:59 AM, Nicolas Haller wrote:
> > I use a new box with 4GB RAM as a pgsql server. In pgsql, you can
> > set the effective_cache_size to indicate the memory available to cache
> > disk I/O.
> > As "recommended", my box use 1300MB to shared buffers (IPC shared memory)
> > and 2700 Mo to disk cache.

> That's probably not a great mix unless your workload is very
> read-heavy. Writes will push data through shared buffers back into the
> OS, which will also try to cache it, so you'll end up with
> double-buffering.

Interresting. My DB is not heavily loaded yet so I don't see any problem
at this time. I just follow recommendations. I thought Postgresql write and
sync disk after writing WAL or doing a checkpoint.

> > If I look memory usage in top, it say:
> > Mem: 1154M Active, 1911M Inact, 601M Wired, 112M Cache, 417M Buf, 148M Free

> The Cache reported by top in FreeBSD isn't filesystem cache; it's a
> cache for some internal stuff. Buf are filesystem buffers, but they're
> not the only mechanism for the OS to cache data. Most data is actually
> cached via active and inactive pages.

Ok, so when Postgresql doing a query for a second time for (very simple)
example, FreeBSD can retrieve data from inactive mem too?

Someone knows if there is a page which explains FreeBSD mechanisms about
memory and fs cache management? I think I must read something on it :-)

Thanks,

-- 
Nicolas Haller



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20101231090612.GN2660>