In the past couple of years replication has been made easier and easier. Setting up streaming replication is pretty easy these days. When doing training I am getting a lot of positive feedback and people seem to like the way entire database instances can be cloned.

In many cases DBAs use a straightforward approach to creating base backups: pg_basebackup.

Potential showstoppers on the way

While this is simple there can be a small issue, which pops up from time to time: What if the I/O capacity of two server is low while the network bandwidth is large? In case of a simple base backup can lead to high disk wait on both servers. The problem is that pg_basebackup running at full speed can easily cause response times to go up because the disk is just to busy reading all the data.

Some customers have reported that this kind of problem even feels like downtime.

The solution to the problem is to control the speed of pg_basebackup. By reducing the backup speed to a reasonable level the disk on the master has enough time to serve normal requests.

The -r flag of pg_basebackup can be used for exactly that:

-r, --max-rate=RATE    maximum transfer rate to transfer data directory

Controlling the speed of your base backups can be a good idea if I/O bandwidth is an issue on your systems. It makes sure that your systems stay responsive all the time – even during a backup.