网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

为什么PostgreSQLcheckpointer后台进程使用这么多内存

这篇文章主要讲解了“为什么PostgreSQL checkpointer后台进程使用这么多内存”,文中的讲解内容简单清晰,易于学习与理解,下面请大家跟着小编的思路慢慢深入,一起来研究和学习“为什么PostgreSQL checkpointer后台进程使用这么多内存”吧!

成都创新互联是一家专业提供南昌企业网站建设,专注与网站设计制作、网站设计H5网站设计、小程序制作等业务。10年已为南昌众多企业、政府机构等服务。创新互联专业网站建设公司优惠进行中。

本节内容来源于PGer的一个问题:
Q:
为什么checkpointer后台进程使用这么多内存?

[pg12@localhost ~]$ ps -aux|grep postgres
pg12      1506  0.0  1.8 753156 34704 ?        Ss   10:30   0:00 /appdb/xdb/pg12beta1/bin/postgres
pg12      1507  0.0  0.0 187304  1472 ?        Ss   10:30   0:00 postgres: logger   
pg12      1509  0.0 24.1 754120 452672 ?       Ss   10:30   0:04 postgres: checkpointer   
pg12      1510  0.0 28.4 753292 533184 ?       Ss   10:30   0:08 postgres: background writer   
pg12      1511  0.0  0.9 753260 18012 ?        Ss   10:30   0:11 postgres: walwriter   
pg12      1513  0.0  0.0 189420  1448 ?        Ss   10:30   0:00 postgres: archiver   last was 00000001000000020000005C
pg12      1514  0.0  0.0 189556  1324 ?        Ss   10:30   0:00 postgres: stats collector   
pg12      1515  0.0  0.1 753688  1984 ?        Ss   10:30   0:00 postgres: logical replication launcher  
pg12      2281  0.0  0.0 112660   972 pts/3    S+   16:38   0:00 grep --color=auto postgres
[pg12@localhost ~]$ grep 'shared' $PGDATA/postgresql.conf 
shared_buffers = 512MB            # min 128kB
#shared_memory_type = mmap        # the default is the first option
dynamic_shared_memory_type = posix    # the default is the first option
#wal_buffers = -1            # min 32kB, -1 sets based on shared_buffers
#shared_preload_libraries = ''    # (change requires restart)

比如上例,共享内存设置为512MB,在2G内存的机器上,checkpointer和background writer进程占用了差不多25%的内存大小.

A:

resident” RAM of a postgres subprocess is often just be the fraction of shared_buffers it’s read/written. checkpointer must necessarily read all dirty pages from s-b and write out to disk (by way of page cache), so that’s why its RSS is nearly 32GB. And the recovery process is continuously writing into s-b.

原因是checkpointer和bg writer需要从shared memory中读取数据(从s-b到page cache)并刷到磁盘上,因此给人占用大量内存的假象.

感谢各位的阅读,以上就是“为什么PostgreSQL checkpointer后台进程使用这么多内存”的内容了,经过本文的学习后,相信大家对为什么PostgreSQL checkpointer后台进程使用这么多内存这一问题有了更深刻的体会,具体使用情况还需要大家实践验证。这里是创新互联,小编将为大家推送更多相关知识点的文章,欢迎关注!


分享标题:为什么PostgreSQLcheckpointer后台进程使用这么多内存
文章链接:http://bjjierui.cn/article/jooigs.html

其他资讯