The answer is a bit more complicated than the question :
The main purpose of a cluster is availability, from the point of view of
- Reads are AP
- Appends are CP
- of hosting in a cloud environment
- each node is typically placed in a different availability zone: a single node could result in full system failure if that zone goes down ( and it does happen )
The other aspect , in cloud environment are the limits of disk iops & throughput
( we do have people frequently depleting those) , a cluster does allow to read from any node , though the data could be stale as it needs to be replicated .
Note on staleness : appends are always written to a quorum of nodes before being acked to the client. You could just happen to read from a node that is a bit behind, the cluster as a whole is consistent .
in other words , when a node fails or is not able to reach the cluster, reading will be available.
So you can read from a follower or read-only replica using
NodePreference in the connection string (
Leader,Follower,Random,ReadOnlyReplica) or in code
The 2 main operations, there are more, that must happen on a Leader are Appending and Persistent Subscriptions as both require to append data .
The reads are not load balanced, doing this will make it more complex for applications to apply concurrency check , when reading from a follower or read-only replica, the code might get 4 as version number , while the leader & other node are at 5 )
Leader, the client will automatically connect to the leader , even if an election happened.
follower , it’s a kind request, you might be connected to a follower or the leader.
ReadOnlyReplica , it needs to be that , except if thare are no RoR available in the cluster , most connect directly to a RoR , not using the cluster DNS or gossip seed.
For a general point of view, what we tell people is to connect to the Leader and measure the overall performance ( response time, iops, throughput) .
When those enter the orange zone, switch reading operation of the reactive side of the system ( think building up read models) to follower and measure. When that enters the orange zone… switch the reactive side of the system to a ReadOnlyReplica and measure.
Switching the needs of the write side of the system is a bit more complicated, though not that much and is rarely needed in my experience.