mirror of
https://github.com/postgres/postgres.git
synced 2025-04-18 13:44:19 +03:00
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
This commit is contained in:
parent
ae3df4b341
commit
2a5e709e72
@ -2585,8 +2585,7 @@ include_dir 'conf.d'
|
||||
session attempts to initiate in parallel. The allowed range is
|
||||
<literal>1</literal> to <literal>1000</literal>, or
|
||||
<literal>0</literal> to disable issuance of asynchronous I/O requests.
|
||||
The default is <literal>16</literal> on supported systems, otherwise
|
||||
<literal>0</literal>.
|
||||
The default is <literal>16</literal>.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@ -2597,8 +2596,9 @@ include_dir 'conf.d'
|
||||
</para>
|
||||
|
||||
<para>
|
||||
On systems without prefetch advice support, attempting to configure
|
||||
any value other than <literal>0</literal> will error out.
|
||||
On systems with prefetch advice support,
|
||||
<varname>effective_io_concurrency</varname> also controls the
|
||||
prefetch distance.
|
||||
</para>
|
||||
|
||||
<para>
|
||||
@ -2621,10 +2621,10 @@ include_dir 'conf.d'
|
||||
for maintenance work that is done on behalf of many client sessions.
|
||||
</para>
|
||||
<para>
|
||||
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"/>).
|
||||
The default is <literal>16</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>
|
||||
|
@ -88,7 +88,7 @@ ALTER TABLESPACE <replaceable>name</replaceable> RESET ( <replaceable class="par
|
||||
and <varname>maintenance_io_concurrency</varname>.
|
||||
Setting these values for a particular tablespace will override the
|
||||
planner's usual estimate of the cost of reading pages from tables in
|
||||
that tablespace, and the executor's prefetching behavior, as established
|
||||
that tablespace, and how many concurrent I/Os are issued, as established
|
||||
by the configuration parameters of the
|
||||
same name (see <xref linkend="guc-seq-page-cost"/>,
|
||||
<xref linkend="guc-random-page-cost"/>,
|
||||
|
@ -110,7 +110,7 @@ CREATE TABLESPACE <replaceable class="parameter">tablespace_name</replaceable>
|
||||
and <varname>maintenance_io_concurrency</varname>.
|
||||
Setting these values for a particular tablespace will override the
|
||||
planner's usual estimate of the cost of reading pages from tables in
|
||||
that tablespace, and the executor's prefetching behavior, as established
|
||||
that tablespace, and how many concurrent I/Os are issued, as established
|
||||
by the configuration parameters of the
|
||||
same name (see <xref linkend="guc-seq-page-cost"/>,
|
||||
<xref linkend="guc-random-page-cost"/>,
|
||||
|
@ -361,11 +361,7 @@ static relopt_int intRelOpts[] =
|
||||
RELOPT_KIND_TABLESPACE,
|
||||
ShareUpdateExclusiveLock
|
||||
},
|
||||
#ifdef USE_PREFETCH
|
||||
-1, 0, MAX_IO_CONCURRENCY
|
||||
#else
|
||||
0, 0, 0
|
||||
#endif
|
||||
},
|
||||
{
|
||||
{
|
||||
@ -374,11 +370,7 @@ static relopt_int intRelOpts[] =
|
||||
RELOPT_KIND_TABLESPACE,
|
||||
ShareUpdateExclusiveLock
|
||||
},
|
||||
#ifdef USE_PREFETCH
|
||||
-1, 0, MAX_IO_CONCURRENCY
|
||||
#else
|
||||
0, 0, 0
|
||||
#endif
|
||||
},
|
||||
{
|
||||
{
|
||||
|
@ -1145,7 +1145,6 @@ check_cluster_name(char **newval, void **extra, GucSource source)
|
||||
void
|
||||
assign_maintenance_io_concurrency(int newval, void *extra)
|
||||
{
|
||||
#ifdef USE_PREFETCH
|
||||
/*
|
||||
* Reconfigure recovery prefetching, because a setting it depends on
|
||||
* changed.
|
||||
@ -1153,7 +1152,6 @@ assign_maintenance_io_concurrency(int newval, void *extra)
|
||||
maintenance_io_concurrency = newval;
|
||||
if (AmStartupProcess())
|
||||
XLogPrefetchReconfigure();
|
||||
#endif
|
||||
}
|
||||
|
||||
/*
|
||||
@ -1249,34 +1247,6 @@ check_default_with_oids(bool *newval, void **extra, GucSource source)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
check_effective_io_concurrency(int *newval, void **extra, GucSource source)
|
||||
{
|
||||
#ifndef USE_PREFETCH
|
||||
if (*newval != 0)
|
||||
{
|
||||
GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack support for issuing read-ahead advice.",
|
||||
"effective_io_concurrency");
|
||||
return false;
|
||||
}
|
||||
#endif /* USE_PREFETCH */
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
check_maintenance_io_concurrency(int *newval, void **extra, GucSource source)
|
||||
{
|
||||
#ifndef USE_PREFETCH
|
||||
if (*newval != 0)
|
||||
{
|
||||
GUC_check_errdetail("\"%s\" must be set to 0 on platforms that lack support for issuing read-ahead advice.",
|
||||
"maintenance_io_concurrency");
|
||||
return false;
|
||||
}
|
||||
#endif /* USE_PREFETCH */
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
check_ssl(bool *newval, void **extra, GucSource source)
|
||||
{
|
||||
|
@ -3235,7 +3235,7 @@ struct config_int ConfigureNamesInt[] =
|
||||
&effective_io_concurrency,
|
||||
DEFAULT_EFFECTIVE_IO_CONCURRENCY,
|
||||
0, MAX_IO_CONCURRENCY,
|
||||
check_effective_io_concurrency, NULL, NULL
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
@ -3249,7 +3249,7 @@ struct config_int ConfigureNamesInt[] =
|
||||
&maintenance_io_concurrency,
|
||||
DEFAULT_MAINTENANCE_IO_CONCURRENCY,
|
||||
0, MAX_IO_CONCURRENCY,
|
||||
check_maintenance_io_concurrency, assign_maintenance_io_concurrency,
|
||||
NULL, assign_maintenance_io_concurrency,
|
||||
NULL
|
||||
},
|
||||
|
||||
|
@ -198,8 +198,8 @@
|
||||
# - I/O -
|
||||
|
||||
#backend_flush_after = 0 # measured in pages, 0 disables
|
||||
#effective_io_concurrency = 16 # 1-1000; 0 disables prefetching
|
||||
#maintenance_io_concurrency = 16 # 1-1000; 0 disables prefetching
|
||||
#effective_io_concurrency = 16 # 1-1000; 0 disables issuing multiple simultaneous IO requests
|
||||
#maintenance_io_concurrency = 16 # 1-1000; same as effective_io_concurrency
|
||||
#io_max_combine_limit = 128kB # usually 1-128 blocks (depends on OS)
|
||||
# (change requires restart)
|
||||
#io_combine_limit = 128kB # usually 1-128 blocks (depends on OS)
|
||||
|
@ -1402,11 +1402,6 @@ setup_config(void)
|
||||
repltok, true);
|
||||
#endif
|
||||
|
||||
#ifndef USE_PREFETCH
|
||||
conflines = replace_guc_value(conflines, "effective_io_concurrency",
|
||||
"0", true);
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
conflines = replace_guc_value(conflines, "update_process_title",
|
||||
"off", true);
|
||||
|
@ -158,14 +158,8 @@ extern PGDLLIMPORT int bgwriter_lru_maxpages;
|
||||
extern PGDLLIMPORT double bgwriter_lru_multiplier;
|
||||
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 16
|
||||
#else
|
||||
#define DEFAULT_EFFECTIVE_IO_CONCURRENCY 0
|
||||
#define DEFAULT_MAINTENANCE_IO_CONCURRENCY 0
|
||||
#endif
|
||||
extern PGDLLIMPORT int effective_io_concurrency;
|
||||
extern PGDLLIMPORT int maintenance_io_concurrency;
|
||||
|
||||
|
@ -61,8 +61,6 @@ extern bool check_default_text_search_config(char **newval, void **extra, GucSou
|
||||
extern void assign_default_text_search_config(const char *newval, void *extra);
|
||||
extern bool check_default_with_oids(bool *newval, void **extra,
|
||||
GucSource source);
|
||||
extern bool check_effective_io_concurrency(int *newval, void **extra,
|
||||
GucSource source);
|
||||
extern bool check_huge_page_size(int *newval, void **extra, GucSource source);
|
||||
extern void assign_io_method(int newval, void *extra);
|
||||
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);
|
||||
extern bool check_log_timezone(char **newval, void **extra, GucSource source);
|
||||
extern void assign_log_timezone(const char *newval, void *extra);
|
||||
extern const char *show_log_timezone(void);
|
||||
extern bool check_maintenance_io_concurrency(int *newval, void **extra,
|
||||
GucSource source);
|
||||
extern void assign_maintenance_io_concurrency(int newval, void *extra);
|
||||
extern void assign_io_max_combine_limit(int newval, void *extra);
|
||||
extern void assign_io_combine_limit(int newval, void *extra);
|
||||
|
Loading…
x
Reference in New Issue
Block a user