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 1ruvsw-008bZV-H0 for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Apr 2024 14:58:43 +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 1ruvsv-001jOA-DL for pgsql-hackers@arkaria.postgresql.org; Thu, 11 Apr 2024 14:58:41 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ruvsv-001jO1-3f for pgsql-hackers@lists.postgresql.org; Thu, 11 Apr 2024 14:58:41 +0000 Received: from mail-io1-xd30.google.com ([2607:f8b0:4864:20::d30]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1ruvss-000OFw-9I for pgsql-hackers@postgresql.org; Thu, 11 Apr 2024 14:58:40 +0000 Received: by mail-io1-xd30.google.com with SMTP id ca18e2360f4ac-7d5db134badso214086839f.2 for ; Thu, 11 Apr 2024 07:58:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1712847516; x=1713452316; 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=+1It3VOMkbgWS5dqU9Izf1aWOSBOWo+PhqVHfGzLCMQ=; b=YKb2grdcALFVt4F4Dh+gVnfAiEMJM+0oXGH23sZH2pBcAaqCh++8ESE9bqbX3sV9yb N2NEPyZXMw/NKceTFydTtwcQa6Y7i2fUzHPOj0K/COvNPBEIbdVucjQvxI67ED7w5Max aAA1HNWz1aYAbKoaho/K7OeMs/VlSz+8AhyyC0mDdOUruahqc4nQjpg0N3wcUAsnVBbK DuJmnUQ4oV+SwXAfGEJWgwQ5eFOAZG7iT6D/vMEYgvbiwk8bymcoM45baoAfL2ePd3pC /P/SlCVeTy28QPj1KSNm9EMOymC7iQWqxUK/GNndv2kiu1Nw30uQAuDOwZ0vNGHqylfC RLmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1712847516; x=1713452316; 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=+1It3VOMkbgWS5dqU9Izf1aWOSBOWo+PhqVHfGzLCMQ=; b=SISSfDe0Vf8XX7irFgjN4FEWI0SPsTXlyLoyCBiiuWdWJF4SWzD24zkC4WBCRiNkoa fZS4Mx7ik4Gt/sW3mx/3fnqNPevt+/sfxBtpns1H3wKKDAxkTOABTml/gE808BkRV7H1 vr6e7URQsncFKv0jCFebVyWv9ZKWUTeYq1TUoSRNwAV7sEUOg4HTffh6i9h+f1+nwmSa VUco55EEzOh0dWXqSQxrfUV2WHiiXo2PlsRu9WK8CvDFeW+3qBYvpqDrSNkEsnLQC3OP eW+puhUzc58Tn2Q/yaLNH8Y/NzUisijEt8Hx5245GKDODRLaDQHr2IJoNw/c57A/DXwX k+3g== X-Gm-Message-State: AOJu0Yx8qC75LMJAYaDgdjs/JdMkleWzzAMlH8y8HQE4IEEa8kNkIzjw WbXomb65+2uupkZD5FTQ7qH3fvW73PCue/M4MaB6t9jcDmLmj+FTrQaKNw== X-Google-Smtp-Source: AGHT+IHuix1iYccYnQSfBV2pWBV3MYbUILCXXa1DOIauy8XV352IR1ff23DdHmZR6GGyqD+wdDiBpQ== X-Received: by 2002:a05:6602:4a04:b0:7d3:eb4b:ca06 with SMTP id eh4-20020a0566024a0400b007d3eb4bca06mr66830iob.4.1712847516137; Thu, 11 Apr 2024 07:58:36 -0700 (PDT) Received: from nathanxps13 (162-195-168-172.lightspeed.stlsmo.sbcglobal.net. [162.195.168.172]) by smtp.gmail.com with ESMTPSA id bo6-20020a056638438600b0047ec5c5b36fsm447230jab.69.2024.04.11.07.58.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 11 Apr 2024 07:58:35 -0700 (PDT) Date: Thu, 11 Apr 2024 09:58:34 -0500 From: Nathan Bossart To: "Imseih (AWS), Sami" Cc: "pgsql-hackers@postgresql.org" Subject: Re: allow changing autovacuum_max_workers without restarting Message-ID: <20240411145834.GA1934019@nathanxps13> References: <20240410212344.GA1824549@nathanxps13> <20240411144240.GD1882158@nathanxps13> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20240411144240.GD1882158@nathanxps13> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On Thu, Apr 11, 2024 at 09:42:40AM -0500, Nathan Bossart wrote: > On Thu, Apr 11, 2024 at 02:24:18PM +0000, Imseih (AWS), Sami wrote: >> max_worker_processes defines a pool of max # of background workers allowed. >> parallel workers and extensions that spin up background workers all utilize from >> this pool. >> >> Should autovacuum_max_workers be able to utilize from max_worker_processes also? >> >> This will allow autovacuum_max_workers to be dynamic while the user only has >> to deal with an already existing GUC. We may want to increase the default value >> for max_worker_processes as part of this. > > My concern with this approach is that other background workers could use up > all the slots and prevent autovacuum workers from starting, unless of > course we reserve autovacuum_max_workers slots for _only_ autovacuum > workers. I'm not sure if we want to get these parameters tangled up like > this, though... I see that the logical replication launcher process uses this pool, but we take special care to make sure it gets a slot: /* * Register the apply launcher. It's probably a good idea to call this * before any modules had a chance to take the background worker slots. */ ApplyLauncherRegister(); I'm not sure there's another way to effectively reserve slots that would work for the autovacuum workers (which need to restart to connect to different databases), so that would need to be invented. We'd probably also want to fail startup if autovacuum_max_workers < max_worker_processes, which seems like it has the potential to cause problems when folks first upgrade to v18. Furthermore, we might have to convert autovacuum workers to background worker processes for this to work. I've admittedly wondered about whether we should do that eventually, anyway, but it'd expand the scope of this work quite a bit. -- Nathan Bossart Amazon Web Services: https://aws.amazon.com