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 1mwozH-0007ho-HM for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Dec 2021 17:19:43 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1mwozE-0004MV-Vg for pgsql-hackers@arkaria.postgresql.org; Mon, 13 Dec 2021 17:19:40 +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 1mwozE-0004MM-Iq for pgsql-hackers@lists.postgresql.org; Mon, 13 Dec 2021 17:19:40 +0000 Received: from mail-il1-x135.google.com ([2607:f8b0:4864:20::135]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1mwozC-0000uc-1x for pgsql-hackers@postgresql.org; Mon, 13 Dec 2021 17:19:40 +0000 Received: by mail-il1-x135.google.com with SMTP id l5so15643326ilv.7 for ; Mon, 13 Dec 2021 09:19:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=telsasoft-com.20210112.gappssmtp.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=QI5L2MD3QH0xkYXO/RCagmtqO0ld25SEfuRLfQnPl/w=; b=uHVTTkh1BQGRLw7ARZviJQIjMjHfLsBNLjWZ02YzNswsnLFbbahOeoODaT8VQWQYh8 ssFU1eJe/6/DerDVscY4vscdOX7pb1Zam+S42uka+ubiY9hheGJSnpz86P/Wno8TIxB7 Qg7xOiCfQ4obU4sy/GG0xQOxxqKRcPL0Ppjp7W8nQY8kTJrVjyLCyr+iiV5vxPAREE0x 4H7BnsYIONXtTxCO2Vxe2vi/Gb4BsbM/Q99D9UKS9wWxCp+Nu7hMVvzn+Hbju171L6Y5 JAJAH1BxzXoGeSk9PYWFZDO72uDyp4ZQKW0M9n9l3Q8hevUxOthWoiI2720wkjDsgn1B CUXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=QI5L2MD3QH0xkYXO/RCagmtqO0ld25SEfuRLfQnPl/w=; b=D9vZxkkZLjVZI4f/IjAXVuPSBO1OxuXSJj6b4o/KkkKIzl4DmxQ1gINUqDbsSl6qCP W+yDpxyyMLowB8crAfsOAbXAYuhRXAA96u95P0+S3WZ/mnS7PYkTsuMXlNvSaAKIANH0 CEPf1tNtH+/kB3KERj61Od0nHR9blyselVOymFrBujTvFXEbrY/8F4Nsw4nZ3DLzR7sT f9dRRYxFHKKCNm5BkLQAusmOUZNrG0lvEbWqH+TY2D448VVfnxmZAdDMHE0lhkmkQQJp O1VM6GyqFXgJwH+bs6IwWoBMn6xUQvjWgq9VcwUwO1GK5XpZXOOLtoHNMOkmtL/wRMB9 xOUQ== X-Gm-Message-State: AOAM531ZC3ll6AO4WBTUiS7TrxHLeXj3o8jGXMwjjj8A996qk1DbfchX kq2oupoZXHy/4b0YgvyhcyV8NQ== X-Google-Smtp-Source: ABdhPJy0YaJL0DcKKVmt3x4gpinquLB/0Yh2ixHRC2pYTltJk3zMrECMSv+z4UcUfQrrLyTCPZ2bQg== X-Received: by 2002:a05:6e02:1945:: with SMTP id x5mr31861315ilu.287.1639415976576; Mon, 13 Dec 2021 09:19:36 -0800 (PST) Received: from pryzbyj.telsasoft (charmander.telsasoft.com. [50.244.222.1]) by smtp.gmail.com with ESMTPSA id y21sm7646859ioj.41.2021.12.13.09.19.36 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Dec 2021 09:19:36 -0800 (PST) Received: by pryzbyj.telsasoft (Postfix, from userid 1000) id 48789800612; Mon, 13 Dec 2021 11:19:35 -0600 (CST) Date: Mon, 13 Dec 2021 11:19:35 -0600 From: Justin Pryzby To: Robert Haas Cc: "Bossart, Nathan" , Bharath Rupireddy , pgsql-hackers@postgresql.org Subject: Re: O(n) tasks cause lengthy startups and checkpoints Message-ID: <20211213171935.GX17618@telsasoft.com> References: <5E58EBB2-3DAE-4400-9EBE-60D1FE4C5B10@amazon.com> <8ACCEA4C-BA36-494B-92B4-EF14DAF1BC3B@amazon.com> <2B230EF6-7509-479C-8C5A-34B56A1B4063@amazon.com> <6DFA78EC-EF4D-4CB0-82C8-AD5DA1B8E0AC@amazon.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.4 (2018-02-28) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Dec 13, 2021 at 08:53:37AM -0500, Robert Haas wrote: > On Fri, Dec 10, 2021 at 2:03 PM Bossart, Nathan wrote: > > Well, I haven't had a chance to look at your patch, and my patch set > > still only has handling for CheckPointSnapBuild() and > > RemovePgTempFiles(), but I thought I'd share what I have anyway. I > > split it into 5 patches: > > > > 0001 - Adds a new "custodian" auxiliary process that does nothing. ... > > I don't know whether this kind of idea is good or not. ... > > Another issue is that we don't want to increase the number of > processes without bound. Processes use memory and CPU resources and if > we run too many of them it becomes a burden on the system. Low-end > systems may not have too many resources in total, and high-end systems > can struggle to fit demanding workloads within the resources that they > have. Maybe it would be cheaper to do more things at once if we were > using threads rather than processes, but that day still seems fairly > far off. Maybe that's an argument that this should be a dynamic background worker instead of an auxilliary process. Then maybe it would be controlled by max_parallel_maintenance_workers (or something similar). The checkpointer would need to do these tasks itself if parallel workers were disabled or couldn't be launched. -- Justin