In the previous post, we discussed about global data distribution in Cosmos DB. In this post, we are going to do a deep dive into replica sets.
Replica sets are a way to implement physical partitions. Replicas are dynamically placed and spread across the machines within a cluster for load balancing. Replicas can also be spread across various datacenters within an Azure region. Each replica contains an instance of Cosmos database engine.
The Cosmos database engine consists of various components which include language runtimes, query processor and storage and indexing subsystems. The database provides high availability feature by persisting the data and indexes on Solid State Drives (SSDs) and replicating them across multiple database instances within the replica-sets.
Replica sets have complex replication protocol to manage the set membership. The set membership is dynamic and can vary between a minimum and maximum value depending on various factors such as number of replication failures, administrative operations and the recovery time of the failed replicas.
To summarize, a replica set is like a Lego block of Cosmos DB, which is used for co-ordination and to provide high availability.
Cosmos DB global distribution model is based on two key concepts, Replica sets and Partition sets. Partition sets will be discussed in a future post.