AWS RDS PostgreSQL(v15)每3小时周期性写入峰值原因排查求助
AWS RDS PostgreSQL(v15)每3小时周期性写入峰值原因排查求助
大家好,我有一台使用频率不高的AWS RDS PostgreSQL 15实例,但每3小时左右的半点时刻(比如06:35、09:35这类)会出现一波写入峰值(原本有对应的监控截图可以佐证)。
一开始我怀疑是自动清理(autovacuum)导致的,于是执行了下面的查询来验证:
select relname,last_vacuum, last_autovacuum, last_analyze, last_autoanalyze from pg_stat_user_tables;
但查询结果显示,自动清理的时间和我观察到的写入峰值时间完全对不上,所以排除了这个可能性。想问问有没有人遇到过类似的情况,这到底是怎么回事?
EDIT:按照评论区@Tim的建议,我开启了数据库日志,但在峰值时间段附近,日志里根本看不到任何实际的业务操作语句,只有一些缓冲区写入相关的记录,而且这些缓冲区写入在其他时间也会发生。下面是几个典型峰值时间段的日志片段:
18:35 UTC 相关日志
2023-11-15 18:29:39 UTC::@:[374]:LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.105 s, sync=0.005 s, total=0.121 s; sync files=3, longest=0.003 s, average=0.002 s; distance=65535 kB, estimate=67050 kB 2023-11-15 18:29:42 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 18:30:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 18:32:42 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 18:33:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 18:34:39 UTC::@:[374]:LOG: checkpoint starting: time 2023-11-15 18:34:39 UTC::@:[374]:LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.105 s, sync=0.005 s, total=0.122 s; sync files=3, longest=0.003 s, average=0.002 s; distance=65536 kB, estimate=66898 kB 2023-11-15 18:35:42 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 18:36:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 18:38:42 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 18:39:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 18:39:39 UTC::@:[374]:LOG: checkpoint starting: time 2023-11-15 18:39:39 UTC::@:[374]:LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 2 recycled; write=0.106 s, sync=0.005 s, total=0.125 s; sync files=3, longest=0.003 s, average=0.002 s; distance=131071 kB, estimate=131071 kB
12:35 UTC 相关日志
2023-11-15 12:34:25 UTC::@:[374]:LOG: checkpoint complete: wrote 7 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.508 s, sync=0.007 s, total=0.531 s; sync files=6, longest=0.005 s, average=0.002 s; distance=65541 kB, estimate=65541 kB 2023-11-15 12:34:28 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 12:36:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 12:37:28 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 12:39:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 12:39:26 UTC::@:[374]:LOG: checkpoint starting: time 2023-11-15 12:39:26 UTC::@:[374]:LOG: checkpoint complete: wrote 5 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.306 s, sync=0.005 s, total=0.323 s; sync files=5, longest=0.003 s, average=0.001 s; distance=65532 kB, estimate=65540 kB
09:35 UTC 相关日志
2023-11-15 09:24:22 UTC::@:[374]:LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.105 s, sync=0.005 s, total=0.121 s; sync files=3, longest=0.003 s, average=0.002 s; distance=65536 kB, estimate=65537 kB 2023-11-15 09:25:28 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 09:27:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 09:28:28 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 09:29:22 UTC::@:[374]:LOG: checkpoint starting: time 2023-11-15 09:29:22 UTC::@:[374]:LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.105 s, sync=0.005 s, total=0.121 s; sync files=3, longest=0.003 s, average=0.002 s; distance=65536 kB, estimate=65537 kB 2023-11-15 09:30:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 09:31:28 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 09:33:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 09:34:22 UTC::@:[374]:LOG: checkpoint starting: time 2023-11-15 09:34:23 UTC::@:[374]:LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.107 s, sync=0.006 s, total=0.125 s; sync files=3, longest=0.004 s, average=0.002 s; distance=65536 kB, estimate=65536 kB 2023-11-15 09:34:28 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 09:36:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 09:37:28 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 09:39:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 09:39:22 UTC::@:[374]:LOG: checkpoint starting: time 2023-11-15 09:39:22 UTC::@:[374]:LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.105 s, sync=0.006 s, total=0.124 s; sync files=3, longest=0.004 s, average=0.002 s; distance=65536 kB, estimate=65536 kB
06:35 UTC 相关日志
2023-11-15 06:29:17 UTC::@:[374]:LOG: checkpoint starting: time 2023-11-15 06:29:17 UTC::@:[374]:LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.105 s, sync=0.004 s, total=0.120 s; sync files=3, longest=0.003 s, average=0.002 s; distance=65536 kB, estimate=65549 kB 2023-11-15 06:30:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 06:31:28 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 06:33:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 06:34:17 UTC::@:[374]:LOG: checkpoint starting: time 2023-11-15 06:34:17 UTC::@:[374]:LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.105 s, sync=0.005 s, total=0.122 s; sync files=3, longest=0.004 s, average=0.002 s; distance=65536 kB, estimate=65547 kB 2023-11-15 06:34:28 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 06:36:19 UTC:10.102.102.132(50721):qd_dev_backend@qd_dev_backend:[14275]:LOG: statement: 2023-11-15 06:37:28 UTC:10.102.103.139(7717):qd_dev_backend@qd_dev_backend:[19325]:LOG: statement: 2023-11-15 06:39:17 UTC::@:[374]:LOG: checkpoint starting: time 2023-11-15 06:39:17 UTC::@:[374]:LOG: checkpoint complete: wrote 3 buffers (0.0%); 0 WAL file(s) added, 0 removed, 1 recycled; write=0.105 s, sync=0.005 s, total=0.122 s; sync files=3, longest=0.003 s, average=0.002 s; distance=65536 kB, estimate=65546 kB
备注:内容来源于stack exchange,提问作者adam-m-hanna
相关产品推荐
相关产品推荐

