Question
How can I improve a WAL Replication Slot?
Environment
Connector: PostgreSQL using Logical Replication (WAL)
Answer
Parameters are set per database cluster and hence tuning this to support consistent and reliable WAL replication.
Recommended values:
- max_wal_size: Default is set to 1 Gb. Set
max_wal_size
to high enough to be rarely reached. - checkpoint_timeout: Default is set to 5 minutes. Set
checkpoint_timeout
to 30mins. - max_wal_sender: Default is set to 10. Ideally set
max_wal_sender
to 3 * Numbers of WAL connectors. - wal_buffer : Default is set to 16MB. Ideally set
wal_buffer
to 64MB - higher value is recommended when there are many concurrent connection to the database.
Cause
- Replication Slot struggle with processing logs either inflated or logs not being cleared.
- WAL Stuck.
- WAL Performance is low.