PGCon2018 - 2.5

PGCon 2018
The PostgreSQL Conference

Sean Chittenden
Day Talks - Day 1: Thursday - 2018-05-31
Room DMS 1120
Start time 13:15
Duration 00:45
ID 1204
Event type Lecture
Track Case Studies
Language used for presentation English

Scaling WAL apply performance on Followers

Eliminate replication lag and reduce startup times with pg_prefaulter

DBAs struggling with replication lag is nothing new. A large volume of data or write IO comes into the system and the followers struggle to keep up. pg_prefaulter was written to eliminate replication lag on followers and also improves database startup times.

If your database is under 24/7 write workload, has periodic replication lag that is unacceptable, or want to reduce the startup time of PostgreSQL, pg_prefaulter will help all three of these scenarios.

At Joyent we use PostgreSQL as the metadata tier for our object storage system, Manta. This talk chronicles how we identified our source of replication lag and why we found it necessary to write pgprefaulter. pgprefaulter is a sidecar process for PostgreSQL written in Go that pre-fetches pages from disk and loads them into the operating system's filesystem cache before PostgreSQL requests them during the startup and application of WAL records.

Additionally, this talk also discusses:

  • the design considerations that went into writing pg_prefaulter
  • the various forms of "replication lag" in PostgreSQL (WAL receive lag, WAL apply lag, and checkpoint lag)
  • pathologies that came from deploying pg_prefaulter
  • why we now consider pg_prefaulter mission critical software for our production databases
  • tips for deploying pg_prefaulter