Same-City Dual-Active DB: RAC, Distributed SQL & Unitized Deployment
The article compares three same-city dual-active database approaches — RAC shared-storage clusters, native distributed databases like OceanBase, and unitized deployment with sharded units — analyzing consistency, performance, and implementation challenges, concluding that unitized deployment combined with distributed databases is the most practical solution.
Reading font
1. Application-Layer Same-City Dual-Active Architecture
Same-city dual-active architecture deploys two or more data centers within one metropolitan area (Region) that simultaneously serve traffic, providing high availability, load balancing, and disaster recovery. Applications are stateless; traffic is distributed via DNS and load balancers. The application layer uses a well-architected (vertical silo) deployment: production and same-city sites have equal resources and can handle each other's traffic, enabling rapid failover when one site fails.
However, same-city applications still write to the production database primary, relying on database-layer replication for consistency. Site-level failures cause lossy failover with global unavailability. To improve availability, database-layer dual-active is required.
2. Database-Layer Same-City Dual-Active Implementation
2.1 Common Data Replication Technologies
Four main types are used in same-city architectures:
Application-based replication : Application writes to both primary and standby databases. Complex, tightly coupled to business logic, high maintenance and data-loss risk; rarely used.
Database-based replication : Uses database logs (logical or physical) to replicate synchronously or asynchronously. Achieves record/transaction-level consistency, mature, low bandwidth; mainstream approach.
Host-based replication : Volume manager or file system on host replicates data. Often used for backup/disaster recovery; few production cases.
Storage-device-based replication : Storage array replicates blocks synchronously (RPO=0) or asynchronously. Requires homogeneous storage, high bandwidth.
Storage-virtualization-based replication : Similar but implemented at virtualization layer, no homogeneous storage requirement.
2.2 Challenges of Database Dual-Write
1) Data consistency issues
Replication lag due to network latency or hardware faults causes primary/standby inconsistency.
Simultaneous writes to two primaries cause conflicts; MySQL dual-primary lacks conflict detection.
Read from a primary that hasn't received latest update yields stale data.
2) Performance issues
Synchronous replication waits for standby acknowledgment, increasing write latency.
Maintaining sync state across multiple instances adds resource overhead.
Conflict resolution mechanisms (distributed locks, optimistic locks, unique constraints) introduce extra overhead.
2.3 RAC Cluster Architecture
RAC (Real Application Clusters) deploys the same database instance on multiple physical nodes sharing storage. A Distributed Lock Manager (DLM) coordinates concurrent access. All nodes can read/write; failover is automatic.
Example: Dameng shared cluster uses shared storage within a single site, with DMASM mirroring for multi-copy resilience. Disk failure triggers automatic failover using mirror copies.
Extending RAC to cross-site dual-active:
Technical difficulties:
Storage layer requires storage virtualization to form a cross-site storage cluster, dependent on Layer-2 network connectivity (wavelength division, storage switches), high cost.
Quorum consistency: database cluster and storage cluster each have their own consistency judgments; mismatch crashes the whole cluster.
Link stability: cross-site latency and instability cause I/O blocking, frequent storage path switching, and frequent cluster arbitration.
Conclusion: RAC + shared storage for dual-active is extremely difficult; few successful production cases.
2.4 Native Distributed Database Implementation
Native distributed databases (e.g., OceanBase) automatically shard tables into tablets distributed across nodes. Each tablet has multiple replicas across nodes, synchronized via Paxos. Deploying production and same-city in one cluster allows configuring tablet placement so both sites have primary replicas, enabling dual-write.
On site failure, primary replicas automatically switch to other nodes, ensuring availability. However, cross-center writes are inevitable, causing:
Cross-center network bandwidth pressure under heavy read/write, impacting transaction performance.
Cross-center latency and jitter affect distributed transaction performance and component health checks.
2.5 Unitized Deployment Architecture
Unitized deployment partitions applications and data by a rule (e.g., region, customer ID) so each unit provides complete service for its data slice. Units are independent, horizontally scalable, fault-isolated. Requires data partitioning: global data split horizontally, non-overlapping, each node has its own application and database.
Unitization combines with distributed databases: different units stored on different database nodes; nodes can further shard by business volume. Achieves physical isolation between units and logical data isolation.
Implementation challenges:
Unit splitting : Design rational partitioning (region, customer ID); align unit and database sharding rules.
Unit scaling : Horizontal scaling of distributed database as business grows.
Unitized HA : Single unit failure doesn't affect globally; combine with distributed DB HA (replica count) to meet RPO/RTO, even site-level dual-active.
Cross-unit data aggregation : For cross-unit analytics, extract, aggregate, and process data from multiple units in batch.
Unitized deployment with database-layer dual-active is a common practical approach: place some units' database primaries in same-city unit, route traffic at gateway layer to appropriate unit.
2.6 Summary
The article discusses same-city dual-active architectures and database-layer implementations. Dual-write on same data is complex. RAC works within a site but cross-site RAC depends on network/storage stability, has many failure modes, and performance may degrade. Native distributed databases support cross-site writes but suffer from cross-center network impact. Unitized deployment combined with distributed databases achieves physical/logical isolation, allows both sites to handle writes, and is the recommended approach for dual-active transformation.
References
https://cloud.tencent.com/developer/article/1645727
https://zhuanlan.zhihu.com/p/703395844
Analysis of Dual-Active Solution Based on Oracle RAC, TWT Community
Research Report on Distributed Database Unit Business Applications, Beijing FinTech Industry Alliance
For questions about attribution, corrections or content rights, please contactand we will review it promptly.