👋
Welcome to my blog!

Data Replication

Dive into the strategies of data replication to ensure data durability and high availability.

Data Replication
System Design
Infrastructure

Published At

7/11/2022

Reading Time

~ 2 min read

According to Wikipedia: Database replication can be used in many database management systems. Usually with a master/slave relationship between the original(master) and the copies(slaves).

  • The master only supports write operation.
  • The slave database gets copies of the data from the master and only supports read operation.

All the database modifying commands must be sent to the master database.

The most application requires a much higher ratio of reads than writes. Thus, the number of slave databases in the system is usually larger than the master databases.

Master Slave

Advantages of Database Replication

  1. Better Performance: In master slave model, all writes and updates happen in master node whereas read operations are distributed across slave nodes. This mode improves performance because it allows more queries to be processed in parallel.
  2. Reliability: If one of your database server is destroyed by a natural disaster (earthquake, etc) data is still preserved.
  3. High Availability: By replicating data across different locations, your website remains in operation even if a database is offline as you can access data stored in another server.

What if database goes offline

If one slave database is available, and it goes offline, then read operations will be directed to master database temporarily.

As soon as the issue is detected, a new slave database will replace the old one.

In case multiple slave database are available, read operations are redirected to other healthy slave database, and a new database slave will replace the old one.

🫑

Do you have any questions, or simply wish to contact me privately? Don't hesitate to shoot me a DM on Twitter.

Have a wonderful day.
Abhishek 🙏

Join My Exclusive Newsletter Community

Step into a world where creativity intersects with technology. By subscribing, you'll get a front-row seat to my latest musings, full-stack development resources, and exclusive previews of future posts. Each email is a crafted experience that includes:

  • In-depth looks at my covert projects and musings to ignite your imagination.
  • Handpicked frontend development resources and current explorations, aimed at expanding your developer toolkit.
  • A monthly infusion of inspiration with my personal selection of quotes, books, and music.

Embrace the confluence of words and wonder, curated thoughtfully and sent straight to your inbox.

No fluff. Just the highest caliber of ideas.