postgresql - postgres transactions rate slows after a while
问题描述
I'm using postgres 12 on ubuntu 20.04 lts. I've noticed that after a while postgres transaction per seconds drops as per the screen shot. In order to test my application, I'm just running a set of API in batch. Batch works fine until certain number of iterations after that it slows downs and transaction rate drops suddenly. Only thing i've noticed out of ordinary is LWLock: WALWriteLock. My wal segment size is default 1GB. Database is running on SSD/xfs file system. I don't know if this is related to checkpoints or something else. Thank you for your time and looking into it.
#------------------------------------------------------------------------------
# WRITE-AHEAD LOG
#------------------------------------------------------------------------------
# - Settings -
#wal_level = replica # minimal, replica, or logical
# (change requires restart)
#fsync = on # flush data to disk for crash safety
# (turning this off can cause
# unrecoverable data corruption)
synchronous_commit = on # synchronization level;
# off, local, remote_write, remote_apply, or on
#wal_sync_method = fsync # the default is the first option
# supported by the operating system:
# open_datasync
# fdatasync (default on Linux)
# fsync
# fsync_writethrough
# open_sync
full_page_writes = on # recover from partial page writes
#wal_compression = off # enable compression of full-page writes
#wal_log_hints = off # also do full page writes of non-critical updates
# (change requires restart)
#wal_init_zero = on # zero-fill new WAL files
#wal_recycle = on # recycle WAL files
wal_buffers = 16MB # min 32kB, -1 sets based on shared_buffers
# (change requires restart)
#wal_writer_delay = 200ms # 1-10000 milliseconds
#wal_writer_flush_after = 1MB # measured in pages, 0 disables
#commit_delay = 0 # range 0-100000, in microseconds
#commit_siblings = 5 # range 1-1000
# - Checkpoints -
#checkpoint_timeout = 5min # range 30s-1d
max_wal_size = 1GB
min_wal_size = 512MB
checkpoint_completion_target = 0.9 # checkpoint target duration, 0.0 - 1.0
#checkpoint_flush_after = 256kB # measured in pages, 0 disables
#checkpoint_warning = 30s # 0 disables
解决方案
推荐阅读
- r - 在R中按人给出百分比读取文件的函数
- python - 2个以上类别的Tensorflow神经网络
- php - 如何解决 PHP 警告:SimpleXMLElement::__construct(): Entity: line 4: parser error
- php - Symfony 5 Mailer 未定义的方法名为“htmlTemplate”
- mongodb - MongoDB Compass 始终通过隧道连接到本地而不是远程数据库
- c - 开发一个程序,该程序将使用一个类型为计算整数 i、j、k、m 平均值的子程序
- go - Golang指针理解
- javascript - 我认为我的 css 类已导入,但我已正确导入
- python - 是否可以在python中动态设置装饰器的名称?
- amazon-web-services - 如何更新私人服务器?