Active-Active vs Active-Passive
Architecture Comparison
Active-Active: Active-Passive:
┌─────────┠┌─────────┠┌─────────┠┌─────────â”
│ Node 1 │ │ Node 2 │ │ Active │ │Standby │
│(Active) │ │(Active) │ │ Node │ │ Node │
└────┬────┘ └────┬────┘ └────┬────┘ └────┬────┘
│ │ │ │
└─────┬─────┘ └─────┬─────┘
â–¼ â–¼
Both serving Only active serving
Traffic (failover on failure)
Comparison
| Aspect | Active-Active | Active-Passive |
|---|---|---|
| Resource usage | 100% both | 50% standby |
| Failover | Instant | Minutes |
| Complexity | Higher | Lower |
| Cost | 2x | 1.5x |
| Load sharing | Yes | No |
Magento Configuration
// Active-Active: Load balancer distributes to both
// app/etc/env.php
'cache' => [
'frontend' => [
'default' => [
'backend' => 'Magento\Framework\Cache\Backend\Redis',
'backend_options' => [
'server' => 'redis-cluster.example.com', // Shared Redis
'port' => '6379'
]
]
]
],
// Both web nodes use same shared Redis/DB
Database Redundancy
MySQL Replication Setup
Primary (Write) → Replica 1 (Read)
→ Replica 2 (Read)
→ Replica 3 (Read)
All replicas sync from primary
Read queries distributed across replicas
Galera Cluster (Multi-Primary)
┌─────────┠┌─────────┠┌─────────â”
│ Node 1 │◀───▶│ Node 2 │◀───▶│ Node 3 │
│(Primary)│ │(Primary)│ │(Primary)│
└─────────┘ └─────────┘ └─────────┘
Synchronous replication
Any node can handle writes
Automatic conflict resolution
Database Redundancy Config
// app/etc/env.php
'db' => [
'connection' => [
'default' => [
'host' => 'primary-db.example.com',
'dbname' => 'magento',
'username' => 'magento_rw',
'password' => '***',
'active' => '1'
],
'read' => [
['host' => 'replica1-db.example.com'],
['host' => 'replica2-db.example.com'],
['host' => 'replica3-db.example.com']
]
]
],
Storage Redundancy
Storage Options
Option | Redundancy | Performance | Cost
────────────────|────────────────|────────────|──────
Local RAID | Disk-level | High | Low
EBS volumes | AZ-level | High | Medium
EFS/NFS | Regional | Medium | Medium
S3 | Regional | Medium | Low
Replicated SAN | Site-level | High | High
File System Redundancy
# RAID 10 for Magento filesystem
mdadm --create /dev/md0 --level=10 --raid-devices=4 \
/dev/sdb1 /dev/sdc1 /dev/sdd1 /dev/sde1
# Mount for Magento
mount /dev/md0 /var/www/magento
Media Storage Redundancy
// Use S3-compatible storage for media
// app/etc/env.php
'filesystem' => [
'drivers' => [
'aws' => [
'config' => [
'bucket' => 'magento-media-prod',
'region' => 'us-east-1',
'use_path_style_endpoint' => false
]
]
]
],
// S3 provides 99.999999999% durability
Redundancy Architecture
Full Redundancy Design
┌─────────────────────────────────────────â”
│ Load Balancer (2 nodes) │
└────────────────┬────────────────────────┘
│
┌────────────────┴────────────────────────â”
│ Web Tier (Active-Active, 3 nodes) │
└────────────────┬────────────────────────┘
│
┌────────────────┴────────────────────────â”
│ Application Tier (Shared Redis) │
└────────────────┬────────────────────────┘
│
┌────────────────┴────────────────────────â”
│ Database Tier (Primary + 2 Replicas) │
└────────────────┬────────────────────────┘
│
┌────────────────┴────────────────────────â”
│ Storage Tier (RAID + S3 Backup) │
└─────────────────────────────────────────┘
Redundancy Checklist
1. Load balancer: 2+ nodes with VIP
2. Web nodes: 3+ with shared sessions
3. Database: Primary + 2 replicas minimum
4. Cache: Redis cluster with 3+ nodes
5. Search: 3+ OpenSearch nodes
6. Storage: RAID + offsite backup
7. Network: Multiple network paths
Quiz
1. What is the main advantage of active-active over active-passive?
2. How many database replicas are recommended for redundancy?
3. What does S3 provide for storage redundancy?
Flashcards
Question
Active-active vs active-passive?
Click to reveal answer
Answer
Active-active: both nodes serve traffic, instant failover; Active-passive: standby waits for failover
Question
Database redundancy minimum?
Click to reveal answer
Answer
Primary + 2 replicas for HA and read scaling
Question
S3 durability?
Click to reveal answer
Answer
99.999999999% (11 nines)
Question
Full redundancy checklist?
Click to reveal answer
Answer
LB, web nodes, DB, cache, search, storage, network
Revision Notes
Key Takeaways
- 1. Active-active provides instant failover and load sharing
- 2. Active-passive is simpler but has failover delay
- 3. Database needs primary + 2 replicas minimum for HA
- 4. S3 provides 11 nines durability for storage
- 5. Every layer needs redundancy to eliminate SPoFs
Interview Tips
- • Compare active-active vs active-passive trade-offs
- • Explain database replication and redundancy strategies
- • Design redundant architecture for all components
Cheat Sheet
Redundancy:
Active-Active: Both serve, instant failover
Active-Passive: Standby waits, delayed failover
Database:
Primary + 2+ replicas
Galera for multi-primary
Storage:
RAID for local redundancy
S3 for offsite (11 nines durability)
Architecture:
LB (2+), Web (3+), DB (1+2), Redis (3+)
Every layer redundant