Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UcKfK-00075T-WF for pgsql-hackers@arkaria.postgresql.org; Tue, 14 May 2013 19:13:39 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.72) (envelope-from ) id 1UcKfK-0001SZ-F2 for pgsql-hackers@arkaria.postgresql.org; Tue, 14 May 2013 19:13:38 +0000 Received: from makus.postgresql.org ([2001:4800:7903:4::125]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UcKfI-0001Qm-7b for pgsql-hackers@postgreSQL.org; Tue, 14 May 2013 19:13:36 +0000 Received: from moutng.kundenserver.de ([212.227.126.187]) by makus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1UcKfF-0003T9-HK for pgsql-hackers@postgreSQL.org; Tue, 14 May 2013 19:13:35 +0000 Received: from [192.168.1.110] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mreu3) with ESMTP (Nemesis) id 0LiJtA-1U6HdH2sFY-00ceiT; Tue, 14 May 2013 21:13:32 +0200 Message-ID: <51928CDA.7030009@2ndQuadrant.com> Date: Tue, 14 May 2013 15:13:30 -0400 From: Greg Smith User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:14.0) Gecko/20120713 Thunderbird/14.0 MIME-Version: 1.0 To: Amit Kapila CC: 'PostgreSQL-development' Subject: Re: Move unused buffers to freelist References: <002f01ce50a8$e057c7a0$a10756e0$@kapila@huawei.com> In-Reply-To: <002f01ce50a8$e057c7a0$a10756e0$@kapila@huawei.com> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Provags-ID: V02:K0:Tiu0jePWn7zAVzB/aOPHzWRjltC0R62zTBB80vQ/M5l J9EeX/D1XYYLUopQ5+lQw/NQynO2gM8lAopWOwxd/wjSQzz2wN Y80m6jrHXvpMvKnTFb5Sb/77MQkRblFyRYblp9x/Bg8ary3tEi YsqBw8lbEOnrdowLAHs9Z+k/IvL8keg5PYVGx05GYVwkhXVkl/ tpaM8pwqaaNIqPtgvDQUI5zSJGqGn/Kt7ROnjaZDx8eb3KIk5Q mgzwGojMA6fhVkGUht60RyrgpNQ5KgLc+b2KiKd+GfKK9ZeeA/ dHRRWnQhXYuJZrB7FVMiaWB6uxXCy2JYGdk8BNS7pflFxlBVxI h8e50R/rLqNYZ5DkSp40= X-Pg-Spam-Score: -0.0 (/) 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 5/14/13 9:42 AM, Amit Kapila wrote: > In the attached patch, bgwriter/checkpointer moves unused (usage_count > =0 && refcount = 0) buffer’s to end of freelist. I have implemented a > new API StrategyMoveBufferToFreeListEnd() to There's a comment in the new function: It is possible that we are told to put something in the freelist that is already in it; don't screw up the list if so. I don't see where the code does anything to handle that though. What was your intention here? This area has always been the tricky part of the change. If you do something complicated when adding new entries, like scanning the freelist for duplicates, you run the risk of holding BufFreelistLock for too long. To try and see that in benchmarks, I would use a small database scale (I typically use 100 for this type of test) and a large number of clients. "-M prepared" would help get a higher transaction rate out of the hardware too. It might take a server with a large core count to notice any issues with holding the lock for too long though. Instead you might just invalidate buffers before they go onto the list. Doing that will then throw away usefully cached data though. To try and optimize both insertion speed and retaining cached data, I was thinking about using a hash table for the free buffers, instead of the simple linked list approach used in the code now. Also: check the formatting on the additions to in bufmgr.c, I noticed a spaces vs. tabs difference on lines 35/36 of your patch. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.com -- Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-hackers