Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEJv5-0001AY-SA for pgsql-general@arkaria.postgresql.org; Mon, 22 Feb 2021 22:43:11 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lEJv4-0003ty-LZ for pgsql-general@arkaria.postgresql.org; Mon, 22 Feb 2021 22:43:10 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEJv4-0003ta-ER for pgsql-general@lists.postgresql.org; Mon, 22 Feb 2021 22:43:10 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEJv2-0006W2-2h for pgsql-general@postgresql.org; Mon, 22 Feb 2021 22:43:10 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 11MMh5oG3612886; Mon, 22 Feb 2021 17:43:05 -0500 From: Tom Lane To: Michael Brown cc: pgsql-general@postgresql.org Subject: Re: fdatasync performance problem with large number of DB files In-reply-to: <30a67c98-243e-eef4-eec7-780fabcaa43b@discourse.org> References: <30a67c98-243e-eef4-eec7-780fabcaa43b@discourse.org> Comments: In-reply-to Michael Brown message dated "Mon, 22 Feb 2021 15:31:42 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <3612884.1614033785.1@sss.pgh.pa.us> Date: Mon, 22 Feb 2021 17:43:05 -0500 Message-ID: <3612885.1614033785@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk Michael Brown writes: > I presume the reason postgres doesn't blindly run a sync() is that we > don't know what other I/O is on the system and it'd be rude to affect > other services. That makes sense, except for our environment the work > done by the recursive fsync is orders of magnitude more disruptive than > a sync(). Hmm. > * is there a knob missing we can configure? No. The trouble with sync() is that per POSIX, it only schedules the writes; there's no way to tell when the work has been done. I see that Linux offers stronger promises in this department, but I don't think that's very portable. Moreover, even on Linux there's no way to detect whether any of the writes failed. Barring some solution to those problems, we would be unlikely to take a patch that uses sync() instead of fsync(). regards, tom lane