“read-balancing” with 8.4.1+

DRBD 8.4.1 introduces a new feature: read-balancing, which is configured in the disk section of the configuration file(s). This feature enables DRBD to balance read requests between the Primary/Secondary nodes.

While writes occur on both sides of the cluster, by default the reads are served locally (ie., the value is prefer-local). This might not be optimal if you’ve got a big pipe to the other node and a heavily loaded IO subsystem.

read-balancing has several options to choose from:

  • 32K-striping up to 1M-striping chooses the node to read from via the block address – eg. for 512K-striping the first half of each MiByte would be read from one machine, and the second half from the other[1. Please note that the distinction is done via the start address of the request, and no request splitting is done; so if your filesystem/application works with a bio size of 1MiByte, every setting lower than 1M-striping would use the same node!].
    This is a simple, static load-balancing.
  • round-robin just passes the request to alternating nodes.
    This might go wrong if your application reads 4kiB, 1MiB, 4kiB, 1MiB, and so on – but this is fairly unlikely.
  • least-pending chooses the node with the smallest number of open requests.
  • when-congested-remote uses the remote node if there are local requests[1. Using bdi_read_congested to decide, see include/linux/backing-dev.h].
  • prefer-remote is implemented for completeness, however as of this writing there is no viable use case.

Please note that all this is still below the filesystem layer – so even if the secondary is used for reading, this won’t speed up a failover, as the pages read are not kept anywhere.