Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UrLHJ-00076m-0Q for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Jun 2013 04:54:53 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.80) (envelope-from ) id 1UrLHI-0003UP-Dc for pgsql-hackers@arkaria.postgresql.org; Tue, 25 Jun 2013 04:54:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UrLHH-0003UH-4T for pgsql-hackers@postgresql.org; Tue, 25 Jun 2013 04:54:51 +0000 Received: from szxga01-in.huawei.com ([119.145.14.64]) by magus.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1UrLHC-0001RE-A6 for pgsql-hackers@postgresql.org; Tue, 25 Jun 2013 04:54:50 +0000 Received: from 172.24.2.119 (EHLO szxeml208-edg.china.huawei.com) ([172.24.2.119]) by szxrg01-dlp.huawei.com (MOS 4.3.4-GA FastPath queued) with ESMTP id BEI17216; Tue, 25 Jun 2013 12:54:39 +0800 (CST) Received: from SZXEML412-HUB.china.huawei.com (10.82.67.91) by szxeml208-edg.china.huawei.com (172.24.2.57) with Microsoft SMTP Server (TLS) id 14.1.323.7; Tue, 25 Jun 2013 12:54:38 +0800 Received: from blrprnc09ns (10.18.96.98) by szxeml412-hub.china.huawei.com (10.82.67.91) with Microsoft SMTP Server id 14.1.323.7; Tue, 25 Jun 2013 12:54:38 +0800 From: Amit Kapila To: "'Robert Haas'" CC: "'Greg Smith'" , "'PostgreSQL-development'" References: <51928CDA.7030009@2ndQuadrant.com> <5194eb32.85d60e0a.1c17.2253SMTPIN_ADDED_BROKEN@mx.google.com> <519b1d5f.9025b40a.2d07.ffffed08SMTPIN_ADDED_BROKEN@mx.google.com> <519f060c.cade440a.493f.ffffb080SMTPIN_ADDED_BROKEN@mx.google.com> <51b033cf.25dc420a.1edd.ffff8fd9SMTPIN_ADDED_BROKEN@mx.google.com> In-Reply-To: Subject: Re: Move unused buffers to freelist Date: Tue, 25 Jun 2013 10:24:36 +0530 Message-ID: <006701ce7160$18706020$49512060$@kapila@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Office Outlook 12.0 Thread-Index: Ac5xAVhCxNZtCu/ZSpqxm80zaYAFPAAW+J4w Content-Language: en-us X-Originating-IP: [10.18.96.98] X-CFilter-Loop: Reflected X-Pg-Spam-Score: -2.9 (--) 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 On Monday, June 24, 2013 11:00 PM Robert Haas wrote: > On Thu, Jun 6, 2013 at 3:01 AM, Amit Kapila > wrote: > > To avoid above 3 factors in test readings, I used below steps: > > 1. Initialize the database with scale factor such that database size > + > > shared_buffers = RAM (shared_buffers = 1/4 of RAM). > > For example: > > Example -1 > > if RAM = 128G, then initialize db with scale factor = > 6700 > > and shared_buffers = 32GB. > > Database size (98 GB) + shared_buffers (32GB) = 130 > (which > > is approximately equal to total RAM) > > Example -2 (this is based on your test m/c) > > If RAM = 64GB, then initialize db with scale factor = > 3400 > > and shared_buffers = 16GB. > > 2. reboot m/c > > 3. Load all buffers with data (tables/indexes of pgbench) using > pg_prewarm. > > I had loaded 3 times, so that usage count of buffers will be > approximately > > 3. > > Hmm. I don't think the usage count will actually end up being 3, > though, because the amount of data you're loading is sized to 3/4 of > RAM, and shared_buffers is just 1/4 of RAM, so I think that each run > of pg_prewarm will end up turning over the entire cache and you'll > never get any usage counts more than 1 this way. Am I confused? The way I am pre-warming is that loading the data of relation (table/index) continuously 3 times, so mostly the buffers will contain the data of relations loaded in last which are indexes and also they got accessed more during scans. So usage count should be 3. Can you please once see load_all_buffers.sql, may be my understanding has some gap. Now about the question why then load all the relations. Apart from PostgreSQL shared buffers, loading data this way can also make sure OS buffers will have the data with higher usage count which can lead to better OS scheduling. > I wonder if it would be beneficial to test the case where the database > size is just a little more than shared_buffers. I think that would > lead to a situation where the usage counts are high most of the time, > which - now that you mention it - seems like the sweet spot for this > patch. I will check this case and take the readings for same. Thanks for your suggestions. With Regards, Amit Kapila. -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers