A PHP Error was encountered

Severity: Notice

Message: Undefined index: markdown

Filename: models/Languages.php

Line Number: 47

Backtrace:

File: /var/www/pastebin.tarcseh.me/application/models/Languages.php
Line: 47
Function: _error_handler

File: /var/www/pastebin.tarcseh.me/application/models/Pastes.php
Line: 429
Function: code_to_description

File: /var/www/pastebin.tarcseh.me/application/controllers/Main.php
Line: 470
Function: getPaste

File: /var/www/pastebin.tarcseh.me/index.php
Line: 284
Function: require_once

# Designing a Geographically Distributed Database Setup Global applications need data close to users without sacrificing correctness. Interviewers use this topic to probe your understanding of replication trade-offs. **Start with requirements.** Where are users? What latency is acceptable? Which data must be strongly consistent, and which can lag? **Single-leader with regional read replicas.** Writes go to one region; reads are served locally. Simple and consistent for writes, but users far from the leader experience slow writes, and replicas may serve stale reads. **Multi-leader replication.** Each region accepts writes and replicates asynchronously. Low write latency everywhere, but concurrent updates to the same record can conflict. You need conflict resolution—last-write-wins, application-level merges, or CRDTs. **Partitioning by geography.** Store each user's data in their home region. Most requests stay local and consistent. Cross-region interactions, such as users messaging across continents, need extra coordination. **Consensus-based databases.** Some systems use distributed consensus to provide strong consistency across regions, at the cost of higher write latency set by inter-region round trips. **Data residency.** Regulations may require certain data to stay within specific countries, which can determine your architecture. **Failover.** Plan how a region takes over if another fails, and how much recent data might be lost. **Example answer.** "I'd home each user's profile and orders in their region, replicate a read-only product catalog globally, and use a strongly consistent store only for the payments ledger." Practicing layered consistency answers with [AI Interview Copilot](https://www.ai-interviewcopilot.com/) helps you show that you choose guarantees per data type. *Written by the AI Interview Copilot team.*