If your user base is geographically distributed, you can add read replicas to improve read latency in regions that are far from your primary region.
Read Replicas are a read-only extension to the primary cluster. With read replicas, the primary data of the cluster is copied across one or more nodes in a different region. Read replicas do not add to write latencies because writes aren't synchronously replicated to replicas - the data is replicated to read replicas asynchronously. To read data from a read replica, you need to enable follower reads for the cluster.
For more information on read replicas and follower reads in YugabyteDB, see the following:
Each read replica cluster can have its own replication factor. The replication factor determines how many copies of your primary data the replica has; multiple copies ensure the availability of the replica in case of a node outage. Replicas do not participate in the primary cluster RAFT consensus, and do not affect the fault tolerance of the primary cluster or contribute to failover.
You can delete, modify, and scale read replicas. Adding or removing nodes incurs a load on the replica. Perform scaling operations when the replica isn't experiencing heavy traffic. Scaling during times of heavy traffic can temporarily degrade performance and increase the length of time of the scaling operation.
The Regions section on the cluster Settings > Infrastructure tab summarizes the cluster configuration, including the number of nodes, vCPUs, memory, and disk per node, and VPC for each region of the primary cluster and its replicas.
Read replicas require the following:
- Primary cluster that is deployed in a VPC.
- Read replicas must be deployed in a VPC. Create a VPC for each region where you want to deploy a read replica. Refer to VPC networking.
- Partition-by-region clusters do not support read replicas.
- If another locking cluster operation is already running, you must wait for it to finish.
Add or edit read replicas
To add or edit read-replicas:
On the Clusters page, select your cluster.
Under Actions, choose Add Read Replicas or Edit Read Replicas.
For each replica, set the following options:
Region - Choose the region where you want to deploy the replica.
VPC - Choose the VPC in which to deploy the nodes. You need to create VPCs before deploying a replica. Refer to VPC networking.
Replication Factor - Enter the number of copies of your data. Replication factor refers to the number of copies of your data in your read replica. This ensures the availability of your read replica in case of node outages. This is independent of the of the fault tolerance of the primary cluster, and does not contribute to failover.
Nodes - Choose the number of nodes to deploy in the region. The number of nodes can't be less than the replication factor.
vCPU/Node: Enter the number of virtual CPUs per node.
Disk size/Node: Enter the disk size per node in GB.
Disk IOPS/Node (AWS only): Enter the disk input output (I/O) operations per second (IOPS) per node. The node throughput will be scaled according to this IOPS value.
Memory per node depends on the instance type available for the selected region.
Monthly total costs for the cluster are based on the number of vCPUs and estimated automatically. + Usage refers to any potential overages from exceeding the free allowances for disk storage, backup storage, and data transfer. For information on how clusters are costed, refer to Cluster costs.
To add a read replica, click Add Region. To delete a read replica, click the Trash icon.
Click Confirm and Save Changes when you are done.
Depending on the number of nodes, adding replicas can take several minutes or more, during which time some cluster operations will not be available.