免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
12
最近访问板块 发新帖
楼主: kfping
打印 上一主题 下一主题

postgresql 进程出现waiting导致网站响应慢,请问如何解决? [复制链接]

论坛徽章:
0
11 [报告]
发表于 2008-01-07 17:18 |只看该作者

回复 #9 kfping 的帖子

1. 操作系的共享內存設定為物理內存的一半就可以了,更改/etc/sysctl.conf
kernel.shmmax =2147483648
kernel.shmall=2147483648
net.core.rmem_default=262144
net.core.rmem_max=262144
net.core.wmem_default=262144
net.core.wmem_max=262144

更改完這個文件過后,以root執行 /sbin/sysctl -p   使配置即刻生效

2. postgresql.conf, 把下面參數的值改成如下,其余參數不要改 (我不記得8.1里面是否支持下面的寫法,如果不支持,換成page; pg的一個page是8k)     如果性能okay了,麻煩回個帖,呵呵
-------------------------------------
shared_buffers=800M
effective_cache_size=2048M
work_mem=1M
maintenance_work_mem=24M

更改完這個文件后,從新啟動數據

论坛徽章:
0
12 [报告]
发表于 2008-01-08 14:09 |只看该作者
感谢roamvalley和horseman的热心关注!

现在暂时没有出现waiting,正在时时监控着,如再有waiting,我会把current_query  贴出来。

1. 操作系的共享內存設定為物理內存的一半就可以了,更改/etc/sysctl.conf

net.core.rmem_default   net.core.rmem_max  net.core.wmem_default  net.core.wmem_max这几个是什么参数?

2. postgresql.conf, 把下面參數的值改成如下,其余參數不要改 (我不記得8.1里面是否支持下面的寫法,如果不支持,換成page; pg的一個page是8k)     如果性能okay了,麻煩回個帖,呵呵
-------------------------------------
shared_buffers=800M
effective_cache_size=2048M
work_mem=1M
maintenance_work_mem=24M

我已经改了以上postgresql.conf,系统性能正在观察中,如性能ok了我立即回帖!

论坛徽章:
0
13 [报告]
发表于 2008-01-08 16:02 |只看该作者

回复 #12 kfping 的帖子

>net.core.rmem_default   net.core.rmem_max  net.core.wmem_default  net.core.wmem_max这几个是什么参数?

IPC 的Cache  能提高網絡在高并發訪問時候的吞吐量,也就是提高網絡性能

论坛徽章:
0
14 [报告]
发表于 2008-01-09 09:51 |只看该作者
谢谢 horseman 的热心解答

vi /etc/sysctl.conf查找net.core.rmem_default   net.core.rmem_max  net.core.wmem_default  net.core.wmem_max
没有找到这几个参数的值?

是不是直接加上就可以了?

还有是不是web服务器和db服务器都要加呢?

[ 本帖最后由 kfping 于 2008-1-9 09:54 编辑 ]

论坛徽章:
0
15 [报告]
发表于 2008-01-09 16:49 |只看该作者

回复 #14 kfping 的帖子

yes, just copy and past the parameters into /etc/sysctl.conf file, and then lunch /sbin/sysctl -p command to refresh the kernel parameter into memory; both you web server and database server.

I would like to recommend you to do sysctl -a |grep  mem_default |grep 'net.core'     and sysctl -a |grep mem_max |grep 'net.core'

to compare the parameter I post and that you collected, if collected parameter is larger than that I post, then do not need to modify it. else, modify it.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP