Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1emod1-0008TF-PI for pgsql-general@arkaria.postgresql.org; Fri, 16 Feb 2018 22:37:15 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.84_2) (envelope-from ) id 1emod0-0005km-1J for pgsql-general@arkaria.postgresql.org; Fri, 16 Feb 2018 22:37:14 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84_2) (envelope-from ) id 1emocz-0005kc-N0 for pgsql-general@lists.postgresql.org; Fri, 16 Feb 2018 22:37:13 +0000 Received: from mail-yw0-x242.google.com ([2607:f8b0:4002:c05::242]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1emocr-0004RN-I3 for pgsql-general@postgresql.org; Fri, 16 Feb 2018 22:37:12 +0000 Received: by mail-yw0-x242.google.com with SMTP id q69so774040ywh.13 for ; Fri, 16 Feb 2018 14:37:04 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=to:from:subject:message-id:date:user-agent:mime-version :content-transfer-encoding:content-language; bh=3LKAVBs+UCpZT/mYCLy2+T+udSIoORuBTK4Nx/av/W4=; b=OBlv3xSbkRGdXzenVXzmSEyfuncwmwVNiA1FBil8JE9aCMb5EAoO6dCI62slQkfeOG r1IXTniGMtV7Ien5tcXCWlku1SntFu7LKXVxqcF9Av/dtp5xH6M1+BBXub3gxut3Efgb tP8D194bBxxcFHNOoLHhbTp2SUft1+z4vq20/CyYGG0fzZ9z/cFBUL99VJkd7VsO0r4R oLZrQVjSFbbUV9sN7cpzpbzVFuCMGZqHUIrkx7nTQcvx10Vf+SZMbb6vhF2QKr3LMjhg y888U1k8Go4t2/2MIEWKXIILtmug7MN6kizEXiW2Bf+6x0kpCuBEsNMSHdloKQCP3OLK oDww== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-transfer-encoding:content-language; bh=3LKAVBs+UCpZT/mYCLy2+T+udSIoORuBTK4Nx/av/W4=; b=rtggAhTOnGx7ludJmcooH4IdHlmnEagTTeDGyhAD8nM2lIrHWjcDFrBxdc/LJtwg32 o4R1BZBrvtX+iGZ93zWTggwjb8G9EHbmrG1SNJ+g9OJDmBtSG/B6kolOGeZcWAyBpz4Z VVYhFINRtDaIGgI+aflx5mhBVS+BvL5JaAAlwIH1W0i0FYgdlu/Is/2PTWYUEGsOQetr A9U65wgVFkQ+jQWZprUrUeVp/VH9yrSDbm9NsrnlUcvLA37P/3bMJ0lsy5ffL7JUuIMi OUc0fxHV2y4Akks0qdCmpRgEkKyhWgVTRbpILNB7kO9Yg5xnVPjV8u6wE6K6T6x2MxG5 i2Xg== X-Gm-Message-State: APf1xPDvobqGRJ52/p81VzZ6CldVDz6R8rB6/SFRW5rhRa+wvDlgjYx3 /8GBIweoi9U08VP4w8YEkZVNnvua X-Google-Smtp-Source: AH8x226BRxnUoPtFKmSpvXTBxlvMUav4bLgVyqKdJLlGNoBgyCIT25b5KtRKhVsrw2rkMrsOyGpBcA== X-Received: by 10.129.85.3 with SMTP id j3mr5676588ywb.351.1518820621007; Fri, 16 Feb 2018 14:37:01 -0800 (PST) Received: from [192.168.1.151] ([178.54.41.83]) by smtp.gmail.com with ESMTPSA id n16sm7523794ywh.105.2018.02.16.14.36.59 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Feb 2018 14:37:00 -0800 (PST) To: pgsql-general@postgresql.org From: Vitaliy Garnashevich Subject: shared_buffers 8GB maximum Message-ID: Date: Sat, 17 Feb 2018 00:36:57 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Content-Language: en-US List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Hi All, I've seen the shared_buffers 8GB maximum recommendation repeated many times. I have several questions in this regard. - Is this recommendation still true for recent versions of postgres? (e.g. wasn't it the case only for really old versions where the locks on shared buffers worked much less efficiently) - I'm not a huge Linux expert, but I've heard someone saying that reading from the filesystem cache requires a context switch. I suspect that such reads are slightly more expensive now after the Meltdown/Spectre patch in the kernel. Could that be a reason for increasing the value of shared_buffers? - Could shared_buffers=128GB or more on a 250 GB RAM server be a reasonable setting? What downsides could there be? PS. Some background. We had shared_buffers=8GB initially. In pg_stat_bgwriter we saw that dirty buffers were written to disk more frequently by backends than during checkpoints (buffers_clean > buffers_checkpoint, and buffers_backend > buffers_checkpoint). According to pg_buffercache extension, there was very small percentage of dirty pages in shared buffers. The percentage of pages with usagecount >= 3 was also low. Some of our more frequently used tables and indexes are more than 10 GB in size. This all suggested that probably the bigger tables and indexes, whenever scanned, are constantly flushing pages from the shared buffers area. After increasing shared_buffers to 32GB, the picture started looking healthier. There were 1GB+ of dirty pages in shared buffers (vs 40-200MB before), 30-60% of pages with usagecount >= 3 (vs 10-40% before), buffers_checkpoint started to grow faster than buffers_clean or buffers_backend. There is still not all frequently used data fits in shared_buffers, so we're considering to increase the parameter more. I wanted to have some idea about how big it could reasonably be. PPS. I know any possible answer might be just a recommendation, and parameter values should be tested for each specific case, but still wanted to hear your opinion. Thanks. Regards, Vitaliy