On Mon, Mar 17, 2025 at 2:55 PM Andres Freund <and...@anarazel.de> wrote:
>
> On 2025-03-17 14:52:02 -0400, Melanie Plageman wrote:
> > I don't feel strongly that we need to be as rigorous for
> > maintenance_io_concurrency, but I'm also not sure 160 seems reasonable
> > (which would be the same ratio as before).
>
> I'd lean towards just setting them to the same value for now.

Cool, here's the patch I intend to commit. I had a bit of trouble
clearly explaining the situation in the commit message which is why I
didn't directly commit it. If no one  has ideas on how to clarify it
by tomorrow, I'll just push it.

- Melanie
From babd220052bcef744e38302e35c6eaee8364027d Mon Sep 17 00:00:00 2001
From: Melanie Plageman <melanieplage...@gmail.com>
Date: Mon, 17 Mar 2025 17:08:49 -0400
Subject: [PATCH v1] Increase default maintenance_io_concurrency to 16

Since its introduction in fc34b0d9de27a, the default
maintenance_io_concurrency has been larger than the default
effective_io_concurrency. This made sense at the time because
maintenance_io_concurrency controlled I/O prefetching done on behalf of
many client sessions (such as in recovery).

ff79b5b2ab increased effective_io_concurrency to 16, so
we'll increase maintenance_io_concurrency as well.

For now, though, we'll keep the defaults of effective_io_concurrency and
maintenance_io_concurrency equal to one another (16).

Since 9256822608f and c3e775e608f, maintenance_io_concurrency also
controls the I/O concurrency of each vacuum worker. Since many
autovacuum workers may be simultaneously issuing I/Os, an appropriate
default value for maintenance_io_concurrency is likely closer to that of
the default effective_io_concurrency rather than the previous ratio
(10x).

Suggested-by: Jakub Wartak <jakub.war...@enterprisedb.com>
Discussion: https://postgr.es/m/CAKZiRmxdHQaU%2B2Zpe6d%3Dx%3D0vigJ1sfWwwVYLJAf%3Dud_wQ_VcUw%40mail.gmail.com
---
 doc/src/sgml/config.sgml                      | 8 ++++----
 src/backend/utils/misc/postgresql.conf.sample | 2 +-
 src/include/storage/bufmgr.h                  | 2 +-
 3 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 3d62c8bd274..a3aae67746b 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -2617,10 +2617,10 @@ include_dir 'conf.d'
          for maintenance work that is done on behalf of many client sessions.
         </para>
         <para>
-         The default is 10 on supported systems, otherwise 0.  This value can
-         be overridden for tables in a particular tablespace by setting the
-         tablespace parameter of the same name (see
-         <xref linkend="sql-altertablespace"/>).
+         The default is <literal>16</literal> on supported systems, otherwise
+         <literal>0</literal>.  This value can be overridden for tables in a
+         particular tablespace by setting the tablespace parameter of the same
+         name (see <xref linkend="sql-altertablespace"/>).
         </para>
        </listitem>
       </varlistentry>
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 8de86e0c945..613d5b3ee39 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -199,7 +199,7 @@
 
 #backend_flush_after = 0		# measured in pages, 0 disables
 #effective_io_concurrency = 16		# 1-1000; 0 disables prefetching
-#maintenance_io_concurrency = 10	# 1-1000; 0 disables prefetching
+#maintenance_io_concurrency = 16	# 1-1000; 0 disables prefetching
 #io_combine_limit = 128kB		# usually 1-32 blocks (depends on OS)
 
 # - Worker Processes -
diff --git a/src/include/storage/bufmgr.h b/src/include/storage/bufmgr.h
index 79a89f87fcc..7f5def6bada 100644
--- a/src/include/storage/bufmgr.h
+++ b/src/include/storage/bufmgr.h
@@ -153,7 +153,7 @@ extern PGDLLIMPORT bool track_io_timing;
 /* only applicable when prefetching is available */
 #ifdef USE_PREFETCH
 #define DEFAULT_EFFECTIVE_IO_CONCURRENCY 16
-#define DEFAULT_MAINTENANCE_IO_CONCURRENCY 10
+#define DEFAULT_MAINTENANCE_IO_CONCURRENCY 16
 #else
 #define DEFAULT_EFFECTIVE_IO_CONCURRENCY 0
 #define DEFAULT_MAINTENANCE_IO_CONCURRENCY 0
-- 
2.34.1

Reply via email to