X-Original-To: pgsql-performance-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [64.117.224.193]) by svr1.postgresql.org (Postfix) with ESMTP id 2A81130DCC2 for ; Tue, 10 Jun 2003 19:08:44 +0000 (GMT) Received: from svr1.postgresql.org ([64.117.224.193]) by localhost (svr1.postgresql.org [64.117.224.193]) (amavisd-new, port 10024) with ESMTP id 26483-08 for ; Tue, 10 Jun 2003 16:08:32 -0300 (ADT) Received: from candle.pha.pa.us (momjian.navpoint.com [207.106.42.251]) by svr1.postgresql.org (Postfix) with ESMTP id 12C7930DC90 for ; Tue, 10 Jun 2003 16:08:28 -0300 (ADT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.11.6) id h5AJ8Mq16858; Tue, 10 Jun 2003 15:08:22 -0400 (EDT) From: Bruce Momjian Message-Id: <200306101908.h5AJ8Mq16858@candle.pha.pa.us> Subject: Re: FW: [ADMIN] Shared_buffers and kernel parameters, tuning In-Reply-To: <200306101128.00609.josh@agliodbs.com> To: josh@agliodbs.com Date: Tue, 10 Jun 2003 15:08:22 -0400 (EDT) Cc: Vincent van Leeuwen , pgsql-performance@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Archive-Number: 200306/38 X-Sequence-Number: 2122 Josh Berkus wrote: > Vincent, > > > This server isn't running postgres that long, and we're still trying to > figure > > out the best configuration parameters for the highest possible performance. > > Shared_buffers was one of the first things we looked at. We've tested with > > shared_buffers at 1024, 8192, 32768 and 131072. So far, performance with > > shared_buffers set at 32768 was the best we could attain. 8192 and 131072 > came > > out roughly equal. 1024 was miserable. > > Cool! This is the first report we've had of a successful higher setting for > shared_buffers. I'll need to revise the text. What do people think of: I have been thinking about shared_buffers, and it seems it is the age-old issue of working set. Traditionally Unix doesn't use working set (though a few do). It just allocates memory proportionally among all processes, with unreferenced pages being paged out first. For PostgreSQL, if your working set is X, if you set your shared buffers to X, you will get optimal performance (assuming there is no memory pressure). If set allocate X/2, you will probably get worse performance. If you allocate X*2, you will also probably get slightly worse performance. Now, let's suppose you can't allocate X shared buffers, because of memory pressure. Suppose you can allocate X/2 shared buffers, and that will leave X/2 kernel buffers. It would be better to allocate X/4 shared buffers, and leave X*3/4 kernel buffers. If you can only allocate X/5 shared buffers, you might be better with X/10 shared buffers because you are going to be doing a lot of I/O, and you need lots of kernel buffers for that. I think that is what people are seeing when modifying shared buffers: X shared buffers is best >X shared buffers is too much overhead and starves kernel