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 1lESuA-0005Dl-Ah for pgsql-general@arkaria.postgresql.org; Tue, 23 Feb 2021 08:18:50 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lESu9-0001zU-9o for pgsql-general@arkaria.postgresql.org; Tue, 23 Feb 2021 08:18:49 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lEPGp-0001F3-8P for pgsql-general@lists.postgresql.org; Tue, 23 Feb 2021 04:25:59 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by makus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lEPGi-0000CP-Dc for pgsql-general@postgresql.org; Tue, 23 Feb 2021 04:25:58 +0000 Received: by mail-io1-xd2e.google.com with SMTP id k17so7930160ioc.5 for ; Mon, 22 Feb 2021 20:25:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=discourse.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=i3OINWoJBcA7902PAceig2ps28w6lYezX6X45LB8G3A=; b=aOP8cHDmBoMMABsuIHXjdslctZTzxJO7ToFQBitm3oPd/98wXaKtieIFUC9HiqrKrJ EOJfbA2MxoJJVfiLgzqg3eG9/EkAvFAnMkDd3uiZ7myCy77LosoBNFLVr2AO0Q2xuBrq KKK6dBq18UdUaU4vceo6JngAK5vQigTk1m+Hw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=i3OINWoJBcA7902PAceig2ps28w6lYezX6X45LB8G3A=; b=otp39mzFqT2l5eRmyZ1sjXdlMPBF2BghUsK0S9qJG0zEjHnJfcqVcirhq107EBd2Fk 8xDX9IyYqDtH14p+V6XGH6OpzF+e+BsIYSM3f3ma7cT5y9BqA1+CqJrFfK59oROtEKdC mxOcmd5Q0RtNZeupfbwq0t6aA+K3LsFQBCDaepfoiSgZzoL1rAt8VPSq6Xs/WWzyfZjT wfc4K3WmWcNviLzlTUh6T9oGpa+15BTDCeBgn6u+ILQpUPxM3CJqwxFUe31SGKMaGCPd P3eDxKZB4meQfjWEze4meebD6krMZsEiSkzGHZ3OQhkiModhxD25PtILf8f3d/055pti PmLw== X-Gm-Message-State: AOAM531DOPjQ6TaOeXaDzRcwahN/vzJgXAT+zT1gTjXZnqxRAU70P3MW I2+2LRFdeZoqlFa5MZgV0BpxNlB2kqivFTIx X-Google-Smtp-Source: ABdhPJyBQHMLzoTlIY2s8cxMx98lbgr7+sbklBmB2z60zYVXcdLlh8Ah1u+KGNyQPthrl4+oViPNrg== X-Received: by 2002:a6b:4e11:: with SMTP id c17mr2607642iob.16.1614054351189; Mon, 22 Feb 2021 20:25:51 -0800 (PST) Received: from [192.168.1.216] (dhcp-24-53-242-66.cable.user.start.ca. [24.53.242.66]) by smtp.gmail.com with ESMTPSA id a5sm3148895ilk.14.2021.02.22.20.25.50 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 22 Feb 2021 20:25:50 -0800 (PST) Subject: Re: fdatasync performance problem with large number of DB files To: Tom Lane Cc: pgsql-general@postgresql.org References: <30a67c98-243e-eef4-eec7-780fabcaa43b@discourse.org> <3612885.1614033785@sss.pgh.pa.us> From: Michael Brown X-Clacks-Overhead: GNU Terry Pratchett Message-ID: <2feba0d3-28c2-08a6-c398-7ddc415293d2@discourse.org> Date: Mon, 22 Feb 2021 23:25:49 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <3612885.1614033785@sss.pgh.pa.us> Content-Type: text/plain; charset=utf-8 Content-Language: en-CA Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On 2021-02-22 5:43 p.m., Tom Lane wrote: > Michael Brown writes: >> * 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 portableTrue, but as mentioned below we're looking for a "this makes sense for our environment" switch. > Moreover, even on Linux there's no way to detect whether any of the writes failed. Ugh. Presumably those would be noticed when the WAL replays? (I'll admit I'd have to look at the sequence of events and think about it, I don't know offhand.) Oh, syncfs() exists but is Linux-specific, again, darn. > Barring some solution to those problems, we would be unlikely to take > a patch that uses sync() instead of fsync(). I wouldn't dare to propose outright switching to sync() for everyone, but a knob we can turn on to say "use sync (or syncfd()) instead" is what we need, discounting a better solution. -- Michael Brown Civilized Discourse Construction Kit, Inc. https://www.discourse.org/