Increase default maintenance_io_concurrency to 16
authorMelanie Plageman <[email protected]>
Tue, 18 Mar 2025 13:08:10 +0000 (09:08 -0400)
committerMelanie Plageman <[email protected]>
Tue, 18 Mar 2025 13:08:10 +0000 (09:08 -0400)
Since its introduction in fc34b0d9de27a, the default
maintenance_io_concurrency has been larger than the default
effective_io_concurrency. maintenance_io_concurrency primarily
controlled prefetching done on behalf of the whole system, for
operations like recovery. Therefore it makes sense for it to have a
value equal to or greater than effective_io_concurrency, which controls
I/O concurrency for reading a relation in a bitmap heap scan.

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).

On fast, high IOPs systems, significantly higher values of
maintenance_io_concurrency are observably beneficial [1]. However, such
values would flood low IOPs systems and increase overall system I/O
latency.

It is worth mentioning that 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, we want to keep maintenance_io_concurrency appropriately
conservative.

[1] https://postgr.es/m/c5d52837-6256-0556-ac8c-d6d3d558820a%40enterprisedb.com

Suggested-by: Jakub Wartak <[email protected]>
Discussion: https://postgr.es/m/CAKZiRmxdHQaU%2B2Zpe6d%3Dx%3D0vigJ1sfWwwVYLJAf%3Dud_wQ_VcUw%40mail.gmail.com

doc/src/sgml/config.sgml
src/backend/utils/misc/postgresql.conf.sample
src/include/storage/bufmgr.h

index 7ec18bb7627b52d728798239e874a4d31931966f..6cd190ac1a02c2e608a39789674a96b6f2f17fd7 100644 (file)
@@ -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>
index 43c2ec2153e96f82d3cfc88137040cd74fef5495..8ac2beb177b05d86b97a5c9580cdc71eb518f949 100644 (file)
 
 #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)
 
 #io_method = sync          # sync (change requires restart)
index 79a89f87fccf6dd2d0b613295113ae0af7550438..7f5def6bada6bafcdde8e3fdac09e6aabe411303 100644 (file)
@@ -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