资讯

精准传达 • 有效沟通

从品牌网站建设到网络营销策划,从策略到执行的一站式服务

为什么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://cdkjz.cn/article/jooigs.html
多年建站经验

多一份参考,总有益处

联系快上网,免费获得专属《策划方案》及报价

咨询相关问题或预约面谈,可以通过以下方式与我们联系

大客户专线   成都:13518219792   座机:028-86922220