DevScript Saga

Welcome to DevScript Saga!

A little Helping Hand for Devs

Database replication is used as Master-Slave relationship between original as Master and copies as slaves. Master database supports write operations and slave database gets copies of the data from master and only supports read operations. All data modifying commands like insert, delete, or update must be sent to master database.

Advantages of Database replication:

  1. Better performance: As it allows more queries to be processed in parallel.
  2. Reliability: If one of our database server is destroyed by a natural disaster, data is still preserved as it is replicated on multiple servers;
  3. High availability: Our application remains in operation even if a database id offline as you can access another server.

What if database goes offline?

  1. If only one slave database is available and it goes offline, read operations will be redirected to master temporarily. As soon as issue is found, a new slave database will replace old one.
  2. In case of multiple slave databases are available and one of it goes offline, rad operations are redirected to other healthy slave databases.
  3. If the master database goes offline, a slave database will be promoted to the new master. All database operations will be temporarily executed on new master database. A new slave database will replace the old one for data replication immediately.

Our system design after adding load balancers and database replication will look like below:

… Next: Database scaling: Sharding

Leave a comment