Skip to content

Faults pages into PostgreSQL shared_buffers or filesystem caches in advance of WAL apply

License

Notifications You must be signed in to change notification settings

bschofield/pg_prefaulter

 
 

Repository files navigation

pg_prefaulter

This is a butchered version of pg_prefaulter, developed by Joyent / @sean-.

Metrics have been removed, go modules added and some minor edits to the code made to pass staticcheck linting.

Building

To build,

go build -o pg_prefaulter main.go

Usage

Please see the original README for motivation and further usage instructions.

Notes

  • Fixed an issue where in pg10+, the code would attempt to prefault files just ahead of the WAL files most recently received, instead of files just ahead of latest WAL files most recently replayed.

  • Using an Intel Optane device, I seem to get best results with a small number of IO threads.

  • I see regular errors due to SQL conflicts with recovery. WAL prefetch would be much better handled inside postgres itself. They're thinking about it, but it seems it won't land until at least pg15.

  • There is a version which uses posix_fadvise() instead of pread() on the 2021-07/posix_fadvise branch. Unfortunately, it turns out that ZFS does not actually support posix_fadvise().

About

Faults pages into PostgreSQL shared_buffers or filesystem caches in advance of WAL apply

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 99.0%
  • DTrace 1.0%