Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rwPCG-001Ohu-Pq for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Apr 2024 16:28:44 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1rwPCD-00E4EL-Ff for pgsql-hackers@arkaria.postgresql.org; Mon, 15 Apr 2024 16:28:41 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rwPCD-00E4E5-5i for pgsql-hackers@lists.postgresql.org; Mon, 15 Apr 2024 16:28:41 +0000 Received: from mail-io1-xd2f.google.com ([2607:f8b0:4864:20::d2f]) by makus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1rwPC8-002zQ9-A8 for pgsql-hackers@postgresql.org; Mon, 15 Apr 2024 16:28:39 +0000 Received: by mail-io1-xd2f.google.com with SMTP id ca18e2360f4ac-7d9a176946dso26377639f.2 for ; Mon, 15 Apr 2024 09:28:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1713198515; x=1713803315; darn=postgresql.org; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:from:to:cc:subject:date:message-id:reply-to; bh=IKYiYI/Xpm7O0tljO0rDHN7xx0pycmeyDCKXDKMTHq4=; b=lMLWa3zLrndBt3DCsuBPEWrn0ComfzfLEm6/ncbIxJpju4Uf98HHT7p4zbIt5QGTXv ZbzSxacZIKiKWUzma8/5AQc4w1qto1wlOsqRyoC+HTJmZZ5iKpyhw9srVlEfwAXxR4Qi +iD5itBlsnh50/M1nIZd71wjUj4GM1fhpF1mNbvOts0VsHMuMpZ95fM8mdbgSAYNJRsk Yl7oQ84JGmNjoAlEXpL5EtL7o7LgR+ITPUl0HIclJ450jdIHlQwH43rj2CDFAjE7fDfI e8qSO+rcgKFDeKdC1015ILjeLF9GsJ686w3JYNAikky42fSxjd0NBwdr3ZQuOKsKFCpK lDjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1713198515; x=1713803315; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=IKYiYI/Xpm7O0tljO0rDHN7xx0pycmeyDCKXDKMTHq4=; b=xQeELpC0GsfGaVnThn15qw3zBHcdiv4WMyc7A1TPtkoX9PH6FLh96wLLNjnztRaMx5 QUy1AvKr7grDBrzxBvgYPVNmwRbyvuQ/k7Exj3ODihl+CITzSLOtNLH5FRVdRLMFkmuY ISvDoRWcWdKJZfpdod6u8DriQpY/xzballQgHSmSbtUaRom4Xah7jQQoy8pynlyVXeyI M73NYgzUG0junJiKQcXr1dc+qoLGehZaBpmp6nheY9+kpOG1rnnSXrsUxDQBksirFZYQ SGt5psayV2fjBkhm6KaRFAFD5BrHRiYnoJsm0xLOJ1TcwP6MQSdW5T0yYQZ19caAoBSt K4kQ== X-Gm-Message-State: AOJu0YxkIrY6CgoSpnlbEK6KRcEslZ5B3eAhrFelTY4DYkcivHu8qjdz Whxwekq1Jj4JwqvqJiN9PVSJ0563B6lzkRMlVug7t2dFBNc6XZlcSaa9Yg== X-Google-Smtp-Source: AGHT+IFksD2uIo86J4+hQSuZvOE7A2acVqi0E9/lW0QPyDGUSKkIlbxDiLn3NbYbXD6XTpauvFmahQ== X-Received: by 2002:a5e:a902:0:b0:7d6:9da9:1a69 with SMTP id c2-20020a5ea902000000b007d69da91a69mr9638862iod.0.1713198515388; Mon, 15 Apr 2024 09:28:35 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id ay24-20020a056638411800b0048300215ce3sm1130111jab.155.2024.04.15.09.28.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Apr 2024 09:28:35 -0700 (PDT) Date: Mon, 15 Apr 2024 11:28:33 -0500 From: Nathan Bossart To: Justin Pryzby Cc: pgsql-hackers@postgresql.org Subject: Re: allow changing autovacuum_max_workers without restarting Message-ID: <20240415162833.GA2857238@nathanxps13> References: <20240410212344.GA1824549@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Mon, Apr 15, 2024 at 08:33:33AM -0500, Justin Pryzby wrote: > On Wed, Apr 10, 2024 at 04:23:44PM -0500, Nathan Bossart wrote: >> The proof-of-concept patch keeps autovacuum_max_workers as the maximum >> number of slots to reserve for workers, but I think we should instead >> rename this parameter to something else and then reintroduce >> autovacuum_max_workers as the new parameter that can be adjusted without >> restarting. That way, autovacuum_max_workers continues to work much the >> same way as in previous versions. > > When I thought about this, I considered proposing to add a new GUC for > "autovacuum_policy_workers". > > autovacuum_max_workers would be the same as before, requiring a restart > to change. The policy GUC would be the soft limit, changable at runtime > up to the hard limit of autovacuum_max_workers (or maybe any policy > value exceeding autovacuum_max_workers would be ignored). > > We'd probably change autovacuum_max_workers to default to a higher value > (8, or 32 as in your patch), and have autovacuum_max_workers default to > 3, for consistency with historic behavior. Maybe > autovacuum_policy_workers=-1 would mean to use all workers. This sounds like roughly the same idea, although it is backwards from what I'm proposing in the v1 patch set. My thinking is that by making a new restart-only GUC that would by default be set higher than the vast majority of systems should ever need, we could simplify migrating to these parameters. The autovacuum_max_workers parameter would effectively retain it's original meaning, and existing settings would continue to work normally on v18, but users could now adjust it without restarting. If we did it the other way, users would need to bump up autovacuum_max_workers and restart prior to being able to raise autovacuum_policy_workers beyond what they previously had set for autovacuum_max_workers. That being said, I'm open to doing it this way if folks prefer this approach, as I think it is still an improvement. > There's the existing idea to change autovacuum thresholds during the > busy period of the day vs. off hours. This would allow something > similar with nworkers rather than thresholds: if the goal were to reduce > the resource use of vacuum, the admin could set max_workers=8, with > policy_workers=2 during the busy period. Precisely. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com