effective_io_concurrency (integer)

Sets the number of concurrent disk I/O operations that PostgreSQL expects can be executed simultaneously. Raising this value will increase the number of I/O operations that any individual PostgreSQL session attempts to initiate in parallel. The allowed range is 1 to 1000, or zero to disable issuance of asynchronous I/O requests. Currently, this setting only affects bitmap heap scans.

For magnetic drives, a good starting point for this setting is the number of separate drives comprising a RAID 0 stripe or RAID 1 mirror being used for the database. (For RAID 5 the parity drive should not be counted.) However, if the database is often busy with multiple queries issued in concurrent sessions, lower values may be sufficient to keep the disk array busy. A value higher than needed to keep the disks busy will only result in extra CPU overhead. SSDs and other memory-based storage can often process many concurrent requests, so the best value might be in the hundreds.

Asynchronous I/O depends on an effective posix_fadvise function, which some operating systems lack. If the function is not present then setting this parameter to anything but zero will result in an error. On some operating systems (e.g., Solaris), the function is present but does not actually do anything.

The default is 1 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 ALTER TABLESPACE).

  

可以根据表空间去设置,不同表空间有关联不同的磁盘整列,选取的策略不一样。

另外,一般来说该参数只会对大量数据页访问时效果显著:

1)设置了该值,磁盘的预读会失效,顺序扫描和索引扫描都可以利用磁盘预读,但bitmap索引扫描不行,是因为effective_io_concurrency参数调用advise64()控制的预读功能造成,effective_io_concurrency的默认值为1,它只对bitmap index scan有效。将effective_io_concurrency禁用,设置为0,磁盘预读也生效了。

2)可以设置大一点,微观上通过strace -p跟踪postgres后端进程看看索引扫描和bitmap索引扫描各自调用的API有什么区别。fadvise64()和read()仍然是交替的,但fadvise64()会提前好几个周期就将相应的预读请求发给IO设备。

ead(33, "\0\0\0\0\3400S\234\0\0\0\0\304\1\350\1\0 \4 \0\0\0\0\270\237\214\0p\237\214\0"..., 8192) = 8192
fadvise64(33, 273088512, 8192, POSIX_FADV_WILLNEED) = 0
lseek(33, 273088512, SEEK_SET) = 273088512
read(33, "\0\0\0\0\250\263S\234\0\0\0\0\304\1\350\1\0 \4 \0\0\0\0\270\237\214\0p\237\214\0"..., 8192) = 8192
fadvise64(33, 273096704, 8192, POSIX_FADV_WILLNEED) = 0
read(33, "\0\0\0\0008\337S\234\0\0\0\0\304\1\350\1\0 \4 \0\0\0\0\270\237\214\0p\237\214\0"..., 8192) = 8192
fadvise64(33, 273154048, 8192, POSIX_FADV_WILLNEED) = 0
lseek(33, 273154048, SEEK_SET) = 273154048
read(33, "\0\0\0\0p\20U\234\0\0\0\0\304\1\350\1\0 \4 \0\0\0\0\270\237\214\0p\237\214\0"..., 8192) = 8192
fadvise64(33, 273170432, 8192, POSIX_FADV_WILLNEED) = 0
lseek(33, 273170432, SEEK_SET) = 273170432
read(33, "\0\0\0\0\250gU\234\0\0\0\0\304\1\350\1\0 \4 \0\0\0\0\270\237\214\0p\237\214\0"..., 8192) = 8192
fadvise64(33, 273211392, 8192, POSIX_FADV_WILLNEED) = 0
lseek(33, 273211392, SEEK_SET) = 273211392
read(33, "\0\0\0\0\250AV\234\0\0\0\0\304\1\350\1\0 \4 \0\0\0\0\270\237\214\0p\237\214\0"..., 8192) = 8192
fadvise64(33, 273219584, 8192, POSIX_FADV_WILLNEED

  

3)如果是SSD,从测试结果看,建议关闭异步IO。(虽然手册中提到如果是内存盘或SSD盘,可以设置更大的值,但是实测效果不理想。)

effective_io_concurrency很重要的一个参数的更多相关文章

  1. esnext:最后一个参数后面也允许加逗号了

    https://jeffmo.github.io/es-trailing-function-commas 目前是一个 stage 3 的提案,Chakra 和 JSC 已经实现了,它允许我们在函数定义 ...

  2. PHP很有用的一个函数ignore_user_abort ()

    PHP很有用的一个函数ignore_user_abort () 2013-01-16 14:21:31|  分类: PHP |  标签:php  函数  |举报|字号 订阅     ignore_us ...

  3. list append 总是复制前面的参数,而不复制最后一个参数

    append 总是复制前面的参数,而不复制最后一个参数 (define a1 '(1 2 3)) (define a2 '(a b c)) (define x (append a1 a2)) x ; ...

  4. 一个参数引起的mysql从库宕机血案

    原创作品,允许转载,转载时请务必以超链接形式标明文章 原始出处 .作者信息和本声明.否则将追究法律责任.http://suifu.blog.51cto.com/9167728/1859252 一个参数 ...

  5. Java 递归调用 recursive 给一个参数 返回一大堆

    需求: 需要组装成对象多层嵌套式的 json字符串; 想到使用 递归来完成这个多层嵌套: 憋了四个小时,终于写出来了; 先看效果: 数据库中的数据: 拼装后的效果: [ EmpVO{ ename='孙 ...

  6. Oracle,Sql,procedure 感觉自己写的很棒的一个存储过程

    感觉自己写的很棒的一个Oracle存储过程,(其实想说很叼^,^). 集成了一堆操作数据的功能(至少几十), 包括存储过程执行异常信息输出帮助诊断. 亮点很多, 比如`over(partition b ...

  7. 使用volley上传多张图片,一个参数对应多张图片,转载

    https://my.oschina.net/u/1177694/blog/491834 原帖地址 而如果使用volley的话,因为请求数据那些都很简便,但遇到上传文件就麻烦那可不好,同时使用多个网络 ...

  8. Qunar机票技术部就有一个全年很关键的一个指标:搜索缓存命中率,当时已经做到了>99.7%。再往后,每提高0.1%,优化难度成指数级增长了。哪怕是千分之一,也直接影响用户体验,影响每天上万张机票的销售额。 在高并发场景下,提供了保证线程安全的对象、方法。比如经典的ConcurrentHashMap,它比起HashMap,有更小粒度的锁,并发读写性能更好。线程安全的StringBuilder取代S

    Qunar机票技术部就有一个全年很关键的一个指标:搜索缓存命中率,当时已经做到了>99.7%.再往后,每提高0.1%,优化难度成指数级增长了.哪怕是千分之一,也直接影响用户体验,影响每天上万张机 ...

  9. APN APN指一种网络接入技术,是通过手机上网时必须配置的一个参数,它决定了手机通过哪种接入方式来访问网络。

    apn 锁定 本词条由“科普中国”百科科学词条编写与应用工作项目 审核 . APN指一种网络接入技术,是通过手机上网时必须配置的一个参数,它决定了手机通过哪种接入方式来访问网络. 对于手机用户来说,可 ...

随机推荐

  1. css,scss解决样式:表格的重叠边框

    初始效果: 解决方法: 给带有边框的元素设置如下样式margin:0 0 -borderwidth -borderwidth 这里的borderwidth即为边框的宽度,按照上图所示,则添加样式 ma ...

  2. IE ActiveObject

    ActiveObject只能用于基于IE内核的浏览器 需要添加信任站点 并设置对ActiveObject的启用 问题: 1.用javascript 创建ActiveX对象时出现:Automation ...

  3. jquery timeStamp属性 语法

    jquery timeStamp属性 语法 作用:timeStamp 属性包含从 1970 年 1 月 1 日到事件被触发时的毫秒数.直线模组 语法:event.timeStam 参数: 参数 描述 ...

  4. android 支持发送空短信

    method:A) AP端修改:1.将ComposeMessageActivity.java 中的 isPreparedForSending() 作如下修改(删掉的code也可以注释掉)private ...

  5. [pytorch笔记] 调整网络学习率

    1. 为网络的不同部分指定不同的学习率 class LeNet(t.nn.Module): def __init__(self): super(LeNet, self).__init__() self ...

  6. 揭秘Android Studio项目目录结构

    I don't know if this is because of the Gradle Build System (I'd wager it is), but I'll tell you what ...

  7. 编译一个需要用特定key前面的应用程序

    LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) # Build all java files in the java subdirectory L ...

  8. C++入门经典-例2.7-控制cout打印格式程序

    1:代码如下: // 2.7.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <iostream> #incl ...

  9. SQL Server高可用实现方案

    名词解释: WSFC:Windows Server Failover Cluster,在Windows Server操作系统上,由WSFC提供高可用性.故障检测和SQL Server AlwaysOn ...

  10. gromacs2018使用踩坑记--insert-molecules

    1] gmx插入分子[ -f [<.gro / .g96 / ...>] ] [ -ci [<.gro / .g96 / ...>] ] [ -ip [<.dat> ...