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 1etTPS-0000TR-AC for pgsql-general@arkaria.postgresql.org; Wed, 07 Mar 2018 07:22:46 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1etTPR-0005g2-9c for pgsql-general@arkaria.postgresql.org; Wed, 07 Mar 2018 07:22:45 +0000 Received: from makus.postgresql.org ([2001:4800:1501:1::229]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.89) (envelope-from ) id 1etTPQ-0005fs-Tk for pgsql-general@lists.postgresql.org; Wed, 07 Mar 2018 07:22:45 +0000 Received: from mx1.mailbox.org ([80.241.60.212]) by makus.postgresql.org with esmtps (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1etTPN-0007F3-CL for pgsql-general@postgresql.org; Wed, 07 Mar 2018 07:22:43 +0000 Received: from smtp1.mailbox.org (smtp1.mailbox.org [80.241.60.240]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.mailbox.org (Postfix) with ESMTPS id 78C5D42B87; Wed, 7 Mar 2018 08:22:37 +0100 (CET) X-Virus-Scanned: amavisd-new at heinlein-support.de Received: from smtp1.mailbox.org ([80.241.60.240]) by gerste.heinlein-support.de (gerste.heinlein-support.de [91.198.250.173]) (amavisd-new, port 10030) with ESMTP id SUbO22Ahe3aB; Wed, 7 Mar 2018 08:22:23 +0100 (CET) Message-ID: <1520407342.2421.8.camel@cybertec.at> Subject: Re: dirty_ratio & dirty_background_ratio settings with huge memory From: Laurenz Albe To: pinker , pgsql-general@postgresql.org Date: Wed, 07 Mar 2018 08:22:22 +0100 In-Reply-To: <1520388352198-0.post@n3.nabble.com> References: <1520331809441-0.post@n3.nabble.com> <1520338619.2601.26.camel@cybertec.at> <1520388352198-0.post@n3.nabble.com> Organization: Cybertec Content-Type: text/plain; charset="UTF-8" Mime-Version: 1.0 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk pinker wrote: > Laurenz Albe wrote > > Yes, you should set vm.dirty_background_bytes and vm.dirty_bytes > > and not use the *_ratio settings. > > > > 2 GB for vm.dirty_background_bytes and 1 GB for vm.dirty_bytes sounds > > fine. To repeat (for the archive): it should be the other way round. > Thank you Laurenz. I was always wondering why not to set bigger window > between those 2. Because setting dirty_background_bytes seems quite natural > for me, i.e. start to write asynchronously faster, but why to provoke stalls > faster? is it not better to stretch the window much wider, like 1GB for > dirty_background_bytes and for instance 20 GB dirty_bytes? it's the Approach > 3: Both Ways from > https://lonesysadmin.net/2013/12/22/better-linux-disk-caching-performance-vm-dirty_ratio/ I'd say that setting vm.dirty_background_bytes low and vm.dirty_bytes very high is not a good idea, at least for databases: - If flushing data to disk in the background can keep up with the write activity, you're fine. But then you'd also be fine with a lower setting for vm.dirty_bytes, right? - If flushing to disk cannot keep up with the write activity, you'll get an I/O spike when everything is flushed to disk at checkpoint time and the database may become unresponsive for a while. The idea behind a low vm.dirty_bytes setting is to avoid one big I/O spike and have several smaller ones instead. Yours, Laurenz Albe -- Cybertec | https://www.cybertec-postgresql.com