Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T9Sdu-0006eZ-Ju for pgsql-performance@postgresql.org; Thu, 06 Sep 2012 03:20:34 +0000 Received: from moutng.kundenserver.de ([212.227.126.171]) by magus.postgresql.org with esmtp (Exim 4.72) (envelope-from ) id 1T9Sds-0004DJ-8L for pgsql-performance@postgresql.org; Thu, 06 Sep 2012 03:20:34 +0000 Received: from [192.168.1.6] (mail.highperformancepostgresql.com [71.179.240.8]) by mrelayeu.kundenserver.de (node=mreu2) with ESMTP (Nemesis) id 0MWOFC-1T3VGG2eKI-00XxAT; Thu, 06 Sep 2012 05:20:30 +0200 Message-ID: <5048167D.6090203@2ndQuadrant.com> Date: Wed, 05 Sep 2012 23:20:29 -0400 From: Greg Smith User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.24) Gecko/20111120 Icedove/3.1.16 MIME-Version: 1.0 To: pgsql-performance@postgresql.org Subject: Re: [repost] Help me develop new commit_delay advice References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Provags-ID: V02:K0:us8tX9WoSYt+IwudFzALhdK6ZpvpPXqjEsaHtaO69S0 WUmHVXSMcXihpMBIduTOE6HTiBiWsT96IgpqNPphMDA0simD3o r5mjlw221uoplcebMcCcaVIUeANH36IEn3hwtNop3m3ttACp0e IDS42U1jNYiM37hovimWXVssq272A8SIByczDVIEGEKldGSXjL 6zikMIzHL8aSgpzEvWHN3GVzNsvkmekmlat7gHUnFFfpHLgDIC PVsLGPtegbxZAwVj6Gy8hbq5czU0fbK4cwJrC5dGmvfoZRBPt8 dcqmlyyQAjiO/KvAQWYlhS/CL5G9QJJ9IrlNZ+xzCo/1TNcn86 0KBBQ9lTU06FfWFHzK3c= X-Pg-Spam-Score: -1.9 (-) X-Archive-Number: 201209/13 X-Sequence-Number: 47759 On 08/02/2012 02:02 PM, Peter Geoghegan wrote: > I made what may turn out to be a useful observation during the > development of the patch, which was that for both the tpc-b.sql and > insert.sql pgbench-tools scripts, a commit_delay of half of my > wal_sync_method's reported raw sync speed looked optimal. I dug up what I wrote when trying to provide better advice for this circa V8.3. That never really gelled into something worth publishing at the time. But I see some similar patterns what what you're reporting, so maybe this will be useful input to you now. That included a 7200RPM drive and a system with a BBWC. In the BBWC case, the only useful tuning I found was to add a very small amount of commit_delay, possibly increasing the siblings too. I was using http://benjiyork.com/blog/2007/04/sleep-considered-harmful.html to figure out the minimum sleep resolution on the server (3us at the time) and setting commit_delay to that; then increasing commit_siblings to 10 or 20. Jignesh Shah came back with something in the same sort of range then at http://jkshah.blogspot.com/2007/07/specjappserver2004-and-postgresql_09.html , setting commit_delay=10. On the 7200RPM drive ~= 115 TPS, 1/2 of the drive's rotation was consistently what worked best for me across multiple tests too. I also found lowering commit_siblings all the way to 1 could significantly improve the 2 client case when you did that. Here's my notes from then: commit_delay=4500, commit_siblings=1: By waiting 1/2 a revolution if there's another active transaction, I get a small improvement at the low-end (around an extra 20 TPS between 2 and 6 clients), while not doing much damage to the higher client loads. This might be a useful tuning if your expected number of active clients are low, you don't have a good caching controller, but you'd like a little more oomph out of things. The results for 7000 usec were almost as good. But in general, if you're stuck choosing between two commit_delay values you should use the smaller one as it will be less likely to have a bad impact on low client loads. I also found considering a high delay only when a lot of clients were usually involved worked a bit better than a 1/2 rotation: commit_delay=10000, commit_siblings=20: At higher client loads, there's almost invariably another commit coming right behind yours if you wait a bit. Just plan to wait a bit more than an entire rotation between commits. This buys me about an extra 30 TPS on the high client loads, which is a small fraction of an improvement (<5%) but might be worthwhile. The fact that it seemed the optimal delay needed to vary a bit based on the number of the siblings was one of the challenges I kept butting into then. Making the GUC settings even more complicated for this doesn't seem a productive step forward for the average user. -- Greg Smith 2ndQuadrant US greg@2ndQuadrant.com Baltimore, MD PostgreSQL Training, Services, and 24x7 Support www.2ndQuadrant.com