DAY3 -> Scaling Databases (Replication)

As in my previous blogs, We talked about vertical scaling. In this We will talk about Horizontal Scaling.

HORIZONTAL SCALING

We know that for any db read & write ratio is 90:10;
The very basic scaling that we can do is have separate db just fo…


This content originally appeared on DEV Community and was authored by Tanisk Annpurna

  • As in my previous blogs, We talked about vertical scaling. In this We will talk about Horizontal Scaling.

HORIZONTAL SCALING

  • We know that for any db read & write ratio is 90:10;
  • The very basic scaling that we can do is have separate db just for reading and separate db for writing.
  • Through API we can send request to replica DB(Read operation) and Master DB(Write operation).

It would look something like shown below. (Replica DB can be multiple)

Master DB with Replicas

  • Data consistency becomes a big part as we don't want data to be different in replica db and in master db. So, its very important to replicate the data.

There are mainly 2 ways to replicate :

  1. SYNCHRONOUS
  2. This means that when there is any write/update operation then through code or DB, we also update replica DB at the same time thus resulting in
  3. More response time
  4. Slower writes
  5. Zero replication logs
  6. Very strong consistency.

Synchronous replication

  1. ASYNCHRONOUS
  2. This means that we keep logs of all the write operations on master db and at certain time we just run those logs on replica dbs. This results in
  3. Small response time
  4. Faster writes as it doesn't write on multiple db at a time, some replication logs
  5. Eventual consistency.

Asynchronous replication


This content originally appeared on DEV Community and was authored by Tanisk Annpurna


Print Share Comment Cite Upload Translate Updates
APA

Tanisk Annpurna | Sciencx (2024-06-21T18:39:43+00:00) DAY3 -> Scaling Databases (Replication). Retrieved from https://www.scien.cx/2024/06/21/day3-scaling-databases-replication/

MLA
" » DAY3 -> Scaling Databases (Replication)." Tanisk Annpurna | Sciencx - Friday June 21, 2024, https://www.scien.cx/2024/06/21/day3-scaling-databases-replication/
HARVARD
Tanisk Annpurna | Sciencx Friday June 21, 2024 » DAY3 -> Scaling Databases (Replication)., viewed ,<https://www.scien.cx/2024/06/21/day3-scaling-databases-replication/>
VANCOUVER
Tanisk Annpurna | Sciencx - » DAY3 -> Scaling Databases (Replication). [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/06/21/day3-scaling-databases-replication/
CHICAGO
" » DAY3 -> Scaling Databases (Replication)." Tanisk Annpurna | Sciencx - Accessed . https://www.scien.cx/2024/06/21/day3-scaling-databases-replication/
IEEE
" » DAY3 -> Scaling Databases (Replication)." Tanisk Annpurna | Sciencx [Online]. Available: https://www.scien.cx/2024/06/21/day3-scaling-databases-replication/. [Accessed: ]
rf:citation
» DAY3 -> Scaling Databases (Replication) | Tanisk Annpurna | Sciencx | https://www.scien.cx/2024/06/21/day3-scaling-databases-replication/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.