Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UN4WD-0000Cx-Vq for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Apr 2013 16:57:10 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UN4WC-0007Vh-R1 for pgsql-hackers@arkaria.postgresql.org; Tue, 02 Apr 2013 16:57:08 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UN4WC-0007Vc-2c for pgsql-hackers@postgresql.org; Tue, 02 Apr 2013 16:57:08 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UN4W5-00053l-W6 for pgsql-hackers@postgresql.org; Tue, 02 Apr 2013 16:57:07 +0000 Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.14.5/8.14.5) with ESMTP id r32Guulw003950; Tue, 2 Apr 2013 12:56:56 -0400 (EDT) From: Tom Lane To: Andres Freund cc: Robert Haas , Merlin Moncure , Jim Nasby , Jeff Janes , Ants Aasma , Atri Sharma , Greg Stark , Amit Kapila , PostgreSQL-development Subject: Re: Page replacement algorithm in buffer cache In-reply-to: <20130402163609.GG2415@alap2.anarazel.de> References: <20130401210920.GC7244@alap2.anarazel.de> <515A1393.9090908@nasby.net> <3236.1364919723@sss.pgh.pa.us> <20130402163609.GG2415@alap2.anarazel.de> Comments: In-reply-to Andres Freund message dated "Tue, 02 Apr 2013 18:36:09 +0200" Date: Tue, 02 Apr 2013 12:56:56 -0400 Message-ID: <3949.1364921816@sss.pgh.pa.us> X-Pg-Spam-Score: -4.2 (----) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-hackers Precedence: bulk Sender: pgsql-hackers-owner@postgresql.org Andres Freund writes: > On 2013-04-02 12:22:03 -0400, Tom Lane wrote: >> I agree in general, though I'm not sure the bgwriter process can >> reasonably handle this need along with what it's already supposed to be >> doing. We may need another background process that is just responsible >> for keeping the freelist populated. > What else is the bgwriter actually doing otherwise? Sure, it doesn't put the > pages on the freelist, but otherwise its trying to do the above isn't it? I think it will be problematic to tie buffer-undirtying to putting both clean and dirty buffers into the freelist. It might chance to work all right to use one scan process for both, but I'm afraid it's more likely that we'd end up either overserving one goal or underserving the other. Also note the entire design of BgBufferSync right now is predicated on the assumption that the rate of motion of the scan strategy point reflects the rate at which new buffers are needed. If backends are supposed to always get new buffers from the freelist, that logic becomes circular: the bgwriter would be watching itself. Perhaps we can refactor the feedback control loop logic so that the buffer scan rate is driven by changes in the length of the freelist, but I'm not sure exactly what the consequences would be. regards, tom lane -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers