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:
1M-stripingchooses the node to read from via the block address – eg. for
512K-stripingthe first half of each MiByte would be read from one machine, and the second half from the other1.
This is a simple, static load-balancing.
round-robinjust 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-pendingchooses the node with the smallest number of open requests.
when-congested-remoteuses the remote node if there are local requests2.
prefer-remoteis 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.
- 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-stripingwould use the same node! ↩
bdi_read_congestedto decide, see include/linux/backing-dev.h ↩