Skip to content

Commit ff79b5b

Browse files
Increase default effective_io_concurrency to 16
The default effective_io_concurrency has been 1 since it was introduced in b7b8f0b. Referencing the associated discussion [1], it seems 1 was chosen as a conservative value that seemed unlikely to cause regressions. Experimentation on high latency cloud storage as well as fast, local nvme storage (see Discussion link) shows that even slightly higher values improve query timings substantially. 1 actually performs worse than 0 [2]. With effective_io_concurrency 1, we are not prefetching enough to avoid I/O stalls, but we are issuing extra syscalls. The new default is 16, which should be more appropriate for common hardware while still avoiding flooding low IOPs devices with I/O requests. [1] https://www.postgresql.org/message-id/flat/FDDBA24E-FF4D-4654-BA75-692B3BA71B97%40enterprisedb.com [2] https://www.postgresql.org/message-id/CAAKRu_Zv08Cic%3DqdCfzrQabpEXGrd9Z9UOW5svEVkCM6%3DFXA9g%40mail.gmail.com Reviewed-by: Andres Freund <[email protected]> Discussion: https://postgr.es/m/CAAKRu_Z%2BJa-mwXebOoOERMMUMvJeRhzTjad4dSThxG0JLXESxw%40mail.gmail.com
1 parent af71731 commit ff79b5b

File tree

3 files changed

+18
-24
lines changed

3 files changed

+18
-24
lines changed

doc/src/sgml/config.sgml

+16-22
Original file line numberDiff line numberDiff line change
@@ -2574,39 +2574,33 @@ include_dir 'conf.d'
25742574
</term>
25752575
<listitem>
25762576
<para>
2577-
Sets the number of concurrent disk I/O operations that
2577+
Sets the number of concurrent storage I/O operations that
25782578
<productname>PostgreSQL</productname> expects can be executed
25792579
simultaneously. Raising this value will increase the number of I/O
2580-
operations that any individual <productname>PostgreSQL</productname> session
2581-
attempts to initiate in parallel. The allowed range is 1 to 1000,
2582-
or zero to disable issuance of asynchronous I/O requests. Currently,
2583-
this setting only affects bitmap heap scans.
2580+
operations that any individual <productname>PostgreSQL</productname>
2581+
session attempts to initiate in parallel. The allowed range is
2582+
<literal>1</literal> to <literal>1000</literal>, or
2583+
<literal>0</literal> to disable issuance of asynchronous I/O requests.
2584+
The default is <literal>16</literal> on supported systems, otherwise
2585+
<literal>0</literal>.
25842586
</para>
25852587

25862588
<para>
2587-
For magnetic drives, a good starting point for this setting is the
2588-
number of separate
2589-
drives comprising a RAID 0 stripe or RAID 1 mirror being used for the
2590-
database. (For RAID 5 the parity drive should not be counted.)
2591-
However, if the database is often busy with multiple queries issued in
2592-
concurrent sessions, lower values may be sufficient to keep the disk
2593-
array busy. A value higher than needed to keep the disks busy will
2594-
only result in extra CPU overhead.
2595-
SSDs and other memory-based storage can often process many
2596-
concurrent requests, so the best value might be in the hundreds.
2589+
Higher values will have the most impact on higher latency storage
2590+
where queries otherwise experience noticeable I/O stalls and on
2591+
devices with high IOPs. Unnecessarily high values may increase I/O
2592+
latency for all queries on the system
25972593
</para>
25982594

25992595
<para>
2600-
Asynchronous I/O requires that the operating system supports issuing
2601-
read-ahead advice. If there is no operating system support then
2602-
setting this parameter to anything but zero will result in an error.
2596+
On systems without prefetch advice support, attempting to configure
2597+
any value other than <literal>0</literal> will error out.
26032598
</para>
26042599

26052600
<para>
2606-
The default is 1 on supported systems, otherwise 0. This value can
2607-
be overridden for tables in a particular tablespace by setting the
2608-
tablespace parameter of the same name (see
2609-
<xref linkend="sql-altertablespace"/>).
2601+
This value can be overridden for tables in a particular tablespace by
2602+
setting the tablespace parameter of the same name (see <xref
2603+
linkend="sql-altertablespace"/>).
26102604
</para>
26112605
</listitem>
26122606
</varlistentry>

src/backend/utils/misc/postgresql.conf.sample

+1-1
Original file line numberDiff line numberDiff line change
@@ -198,7 +198,7 @@
198198
# - I/O -
199199

200200
#backend_flush_after = 0 # measured in pages, 0 disables
201-
#effective_io_concurrency = 1 # 1-1000; 0 disables prefetching
201+
#effective_io_concurrency = 16 # 1-1000; 0 disables prefetching
202202
#maintenance_io_concurrency = 10 # 1-1000; 0 disables prefetching
203203
#io_combine_limit = 128kB # usually 1-32 blocks (depends on OS)
204204

src/include/storage/bufmgr.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ extern PGDLLIMPORT bool track_io_timing;
152152

153153
/* only applicable when prefetching is available */
154154
#ifdef USE_PREFETCH
155-
#define DEFAULT_EFFECTIVE_IO_CONCURRENCY 1
155+
#define DEFAULT_EFFECTIVE_IO_CONCURRENCY 16
156156
#define DEFAULT_MAINTENANCE_IO_CONCURRENCY 10
157157
#else
158158
#define DEFAULT_EFFECTIVE_IO_CONCURRENCY 0

0 commit comments

Comments
 (0)