Safety buddy system for disaster recovery


What is Synchronous Replication?

Synchronous = Both must confirm before moving on

Think of it like a safety buddy system where both databases must save the data before confirming success.


How It Works: Step-by-Step

User saves a post "Hello World"

1. Main Database receives write request
        ↓
2. Main Database: "Wait! Let me tell my standby buddy first"
        ↓
3. Main Database sends data to Standby Database
        ↓
4. Standby Database saves it: "I got it!"
        ↓
5. ONLY NOW Main Database tells user: "Your post is saved!"

Why Synchronous?

Because Multi-AZ is for DISASTER RECOVERY

If the main database crashes right after saving data, the standby MUST already have that data.


Async vs Sync Comparison

Bad Scenario (If Async)

Main DB: Saves "Hello World"Main DB: Crashes!  (before sending to standby)
Standby DB: Becomes new main (doesn't have "Hello World") 
Data LOST!

Good Scenario (Sync)

Main DB: Saves "Hello World"
Standby DB: Also saves "Hello World" 
Main DB: Crashes! 
Standby DB: Becomes new main (HAS "Hello World") 
Data SAFE!