Skip to content

Commit 2a5e709

Browse files
committed
Enable IO concurrency on all systems
Previously effective_io_concurrency and maintenance_io_concurrency could not be set above 0 on machines without fadvise support. AIO enables IO concurrency without such support, via io_method=worker. Currently only subsystems using the read stream API will take advantage of this. Other users of maintenance_io_concurrency (like recovery prefetching) which leverage OS advice directly will not benefit from this change. In those cases, maintenance_io_concurrency will have no effect on I/O behavior. Author: Melanie Plageman <melanieplageman@gmail.com> Reviewed-by: Noah Misch <noah@leadboat.com> Discussion: https://postgr.es/m/CAAKRu_atGgZePo=_g6T3cNtfMf0QxpvoUh5OUqa_cnPdhLd=gw@mail.gmail.com
1 parent ae3df4b commit 2a5e709

File tree

10 files changed

+14
-67
lines changed

10 files changed

+14
-67
lines changed

doc/src/sgml/config.sgml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2585,8 +2585,7 @@ include_dir 'conf.d'
25852585
session attempts to initiate in parallel. The allowed range is
25862586
<literal>1</literal> to <literal>1000</literal>, or
25872587
<literal>0</literal> to disable issuance of asynchronous I/O requests.
2588-
The default is <literal>16</literal> on supported systems, otherwise
2589-
<literal>0</literal>.
2588+
The default is <literal>16</literal>.
25902589
</para>
25912590

25922591
<para>
@@ -2597,8 +2596,9 @@ include_dir 'conf.d'
25972596
</para>
25982597

25992598
<para>
2600-
On systems without prefetch advice support, attempting to configure
2601-
any value other than <literal>0</literal> will error out.
2599+
On systems with prefetch advice support,
2600+
<varname>effective_io_concurrency</varname> also controls the
2601+
prefetch distance.
26022602
</para>
26032603

26042604
<para>
@@ -2621,10 +2621,10 @@ include_dir 'conf.d'
26212621
for maintenance work that is done on behalf of many client sessions.
26222622
</para>
26232623
<para>
2624-
The default is <literal>16</literal> on supported systems, otherwise
2625-
<literal>0</literal>. This value can be overridden for tables in a
2626-
particular tablespace by setting the tablespace parameter of the same
2627-
name (see <xref linkend="sql-altertablespace"/>).
2624+
The default is <literal>16</literal>. This value can be overridden
2625+
for tables in a particular tablespace by setting the tablespace
2626+
parameter of the same name (see <xref
2627+
linkend="sql-altertablespace"/>).
26282628
</para>
26292629
</listitem>
26302630
</varlistentry>

doc/src/sgml/ref/alter_tablespace.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ ALTER TABLESPACE <replaceable>name</replaceable> RESET ( <replaceable class="par
8888
and <varname>maintenance_io_concurrency</varname>.
8989
Setting these values for a particular tablespace will override the
9090
planner's usual estimate of the cost of reading pages from tables in
91-
that tablespace, and the executor's prefetching behavior, as established
91+
that tablespace, and how many concurrent I/Os are issued, as established
9292
by the configuration parameters of the
9393
same name (see <xref linkend="guc-seq-page-cost"/>,
9494
<xref linkend="guc-random-page-cost"/>,

doc/src/sgml/ref/create_tablespace.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ CREATE TABLESPACE <replaceable class="parameter">tablespace_name</replaceable>
110110
and <varname>maintenance_io_concurrency</varname>.
111111
Setting these values for a particular tablespace will override the
112112
planner's usual estimate of the cost of reading pages from tables in
113-
that tablespace, and the executor's prefetching behavior, as established
113+
that tablespace, and how many concurrent I/Os are issued, as established
114114
by the configuration parameters of the
115115
same name (see <xref linkend="guc-seq-page-cost"/>,
116116
<xref linkend="guc-random-page-cost"/>,

src/backend/access/common/reloptions.c

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -361,11 +361,7 @@ static relopt_int intRelOpts[] =
361361
RELOPT_KIND_TABLESPACE,
362362
ShareUpdateExclusiveLock
363363
},
364-
#ifdef USE_PREFETCH
365364
-1, 0, MAX_IO_CONCURRENCY
366-
#else
367-
0, 0, 0
368-
#endif
369365
},
370366
{
371367
{
@@ -374,11 +370,7 @@ static relopt_int intRelOpts[] =
374370
RELOPT_KIND_TABLESPACE,
375371
ShareUpdateExclusiveLock
376372
},
377-
#ifdef USE_PREFETCH
378373
-1, 0, MAX_IO_CONCURRENCY
379-
#else
380-
0, 0, 0
381-
#endif
382374
},
383375
{
384376
{

src/backend/commands/variable.c

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,15 +1145,13 @@ check_cluster_name(char **newval, void **extra, GucSource source)
11451145
void
11461146
assign_maintenance_io_concurrency(int newval, void *extra)
11471147
{
1148-
#ifdef USE_PREFETCH
11491148
/*
11501149
* Reconfigure recovery prefetching, because a setting it depends on
11511150
* changed.
11521151
*/
11531152
maintenance_io_concurrency = newval;
11541153
if (AmStartupProcess())
11551154
XLogPrefetchReconfigure();
1156-
#endif
11571155
}
11581156

11591157
/*
@@ -1249,34 +1247,6 @@ check_default_with_oids(bool *newval, void **extra, GucSource source)
12491247
return true;
12501248
}
12511249

1252-
bool
1253-
check_effective_io_concurrency(int *newval, void **extra, GucSource source)
1254-
{
1255-
#ifndef USE_PREFETCH
1256-
if (*newval != 0)
1257-
{
1258-
GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack support for issuing read-ahead advice.",
1259-
"effective_io_concurrency");
1260-
return false;
1261-
}
1262-
#endif /* USE_PREFETCH */
1263-
return true;
1264-
}
1265-
1266-
bool
1267-
check_maintenance_io_concurrency(int *newval, void **extra, GucSource source)
1268-
{
1269-
#ifndef USE_PREFETCH
1270-
if (*newval != 0)
1271-
{
1272-
GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack support for issuing read-ahead advice.",
1273-
"maintenance_io_concurrency");
1274-
return false;
1275-
}
1276-
#endif /* USE_PREFETCH */
1277-
return true;
1278-
}
1279-
12801250
bool
12811251
check_ssl(bool *newval, void **extra, GucSource source)
12821252
{

src/backend/utils/misc/guc_tables.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3235,7 +3235,7 @@ struct config_int ConfigureNamesInt[] =
32353235
&effective_io_concurrency,
32363236
DEFAULT_EFFECTIVE_IO_CONCURRENCY,
32373237
0, MAX_IO_CONCURRENCY,
3238-
check_effective_io_concurrency, NULL, NULL
3238+
NULL, NULL, NULL
32393239
},
32403240

32413241
{
@@ -3249,7 +3249,7 @@ struct config_int ConfigureNamesInt[] =
32493249
&maintenance_io_concurrency,
32503250
DEFAULT_MAINTENANCE_IO_CONCURRENCY,
32513251
0, MAX_IO_CONCURRENCY,
3252-
check_maintenance_io_concurrency, assign_maintenance_io_concurrency,
3252+
NULL, assign_maintenance_io_concurrency,
32533253
NULL
32543254
},
32553255

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -198,8 +198,8 @@
198198
# - I/O -
199199

200200
#backend_flush_after = 0 # measured in pages, 0 disables
201-
#effective_io_concurrency = 16 # 1-1000; 0 disables prefetching
202-
#maintenance_io_concurrency = 16 # 1-1000; 0 disables prefetching
201+
#effective_io_concurrency = 16 # 1-1000; 0 disables issuing multiple simultaneous IO requests
202+
#maintenance_io_concurrency = 16 # 1-1000; same as effective_io_concurrency
203203
#io_max_combine_limit = 128kB # usually 1-128 blocks (depends on OS)
204204
# (change requires restart)
205205
#io_combine_limit = 128kB # usually 1-128 blocks (depends on OS)

src/bin/initdb/initdb.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,11 +1402,6 @@ setup_config(void)
14021402
repltok, true);
14031403
#endif
14041404

1405-
#ifndef USE_PREFETCH
1406-
conflines = replace_guc_value(conflines, "effective_io_concurrency",
1407-
"0", true);
1408-
#endif
1409-
14101405
#ifdef WIN32
14111406
conflines = replace_guc_value(conflines, "update_process_title",
14121407
"off", true);

src/include/storage/bufmgr.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,8 @@ extern PGDLLIMPORT int bgwriter_lru_maxpages;
158158
extern PGDLLIMPORT double bgwriter_lru_multiplier;
159159
extern PGDLLIMPORT bool track_io_timing;
160160

161-
/* only applicable when prefetching is available */
162-
#ifdef USE_PREFETCH
163161
#define DEFAULT_EFFECTIVE_IO_CONCURRENCY 16
164162
#define DEFAULT_MAINTENANCE_IO_CONCURRENCY 16
165-
#else
166-
#define DEFAULT_EFFECTIVE_IO_CONCURRENCY 0
167-
#define DEFAULT_MAINTENANCE_IO_CONCURRENCY 0
168-
#endif
169163
extern PGDLLIMPORT int effective_io_concurrency;
170164
extern PGDLLIMPORT int maintenance_io_concurrency;
171165

src/include/utils/guc_hooks.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,6 @@ extern bool check_default_text_search_config(char **newval, void **extra, GucSou
6161
extern void assign_default_text_search_config(const char *newval, void *extra);
6262
extern bool check_default_with_oids(bool *newval, void **extra,
6363
GucSource source);
64-
extern bool check_effective_io_concurrency(int *newval, void **extra,
65-
GucSource source);
6664
extern bool check_huge_page_size(int *newval, void **extra, GucSource source);
6765
extern void assign_io_method(int newval, void *extra);
6866
extern bool check_io_max_concurrency(int *newval, void **extra, GucSource source);
@@ -83,8 +81,6 @@ extern bool check_log_stats(bool *newval, void **extra, GucSource source);
8381
extern bool check_log_timezone(char **newval, void **extra, GucSource source);
8482
extern void assign_log_timezone(const char *newval, void *extra);
8583
extern const char *show_log_timezone(void);
86-
extern bool check_maintenance_io_concurrency(int *newval, void **extra,
87-
GucSource source);
8884
extern void assign_maintenance_io_concurrency(int newval, void *extra);
8985
extern void assign_io_max_combine_limit(int newval, void *extra);
9086
extern void assign_io_combine_limit(int newval, void *extra);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy