admin管理员组

文章数量:1530236

os: centos 7.4
db: postgresql 11.5

effective_io_concurrency (integer)

设置PostgreSQL可以同时被执行的并发磁盘 I/O 操作的数量。

调高这个值,可以增加任何单个PostgreSQL会话试图并行发起的 I/O 操作的数目。

允许的范围是 1 到 1000,或 0 表示禁用异步 I/O 请求。当前这个设置仅影响位图堆扫描。

对于磁盘驱动器,这个设置的一个很好的出发点是组成一个被用于该数据库的 RAID 0 条带或 RAID 1 镜像的独立驱动器数量(对 RAID 5 而言,校验驱动器不计入)。

但是, 如果数据库经常忙于在并发会话中发出的多个查询,较低的值可能足以使磁盘阵列繁忙。比保持磁盘繁忙所需的值更高的值只会造成额外的 CPU 开销。

SSD 以及其他基于内存的存储常常能处理很多并发请求,因此它们的最佳值可能是数百

异步 I/O 依赖于一个有效的 posix_fadvise 函数(一些操作系统可能没有)。 如果不存在这个函数,将这个参数设置为除 0 之外的任何东西将导致错误。在一些操作系统上(如Solaris)虽然提供了这个函数,但它不会做任何事情。

在支持的系统上默认值为 1,否则为 0。对于一个特定表空间中的表,可以通过设定该表空间的同名参数(见ALTER TABLESPACE)可以覆盖这个值。

版本

# cat /etc/centos-release
CentOS Linux release 7.4.1708 (Core) 
# 
# su - postgres
Last login: Sat Oct 26 22:55:25 CST 2019 on pts/0
$
$ psql -c "select version();"
                                                 version                                                 
---------------------------------------------------------------------------------------------------------
 PostgreSQL 11.5 on x86_64-pc-linux-gnu, compiled by gcc (GCC) 4.8.5 20150623 (Red Hat 4.8.5-36), 64-bit
(1 row)

effective_io_concurrency

设置了该值,磁盘的预读会失效,顺序扫描和索引扫描都可以利用磁盘预读,但bitmap索引扫描不行。
参数默认是 1,只对 bitmap index scan 有效,可以调整的范围为 0 ~ 1000

postgres=# \x

postgres=# select * from pg_settings where name='effective_io_concurrency';
-[ RECORD 1 ]---+-----------------------------------------------------------------------------------------
name            | effective_io_concurrency
setting         | 100
unit            | 
category        | Resource Usage / Asynchronous Behavior
short_desc      | Number of simultaneous requests that can be handled efficiently by the disk subsystem.
extra_desc      | For RAID arrays, this should be approximately the number of drive spindles in the array.
context         | user
vartype         | integer
source          | configuration file
min_val         | 0
max_val         | 1000
enumvals        | 
boot_val        | 1
reset_val       | 100
sourcefile      | /var/lib/pgsql/11/data/postgresql.conf
sourceline      | 166
pending_restart | f

参考:
http://postgres/docs/11/runtime-config-resource.html
https://www.postgresql/docs/11/runtime-config-resource.html

本文标签: 性能参数effectiveioconcurrencyIO