Skip to content

Instantly share code, notes, and snippets.

@geoffharcourt
geoffharcourt / warmup.rb
Created June 3, 2021 10:22 — forked from jwhiting/warmup.rb
Warming up EBS volumes on RDS replicas/snapshots (ruby script)
#!/usr/bin/env ruby
require 'pg'
=begin
when creating a postgres db replica in RDS, or restoring from a snapshot, the
underlying EBS volume of the new instance must be initialized by reading every
block, otherwise the blocks will be lazy-initialized by production queries
which will be extremely latent. (i've seen normally 50ms queries take 30s in