Data Architecture Patterns#

Data outlives applications. The services you build today will be rewritten, but the data they produce will still matter in ten years. Cloud data architecture is about choosing the right storage for each workload, placing data where it needs to be, and ensuring it’s protected, governed, and accessible.


Polyglot Persistence#

Using a single database for everything is an anti-pattern. Different data access patterns require different storage engines.

Storage Selection Framework#

Access PatternBest Storage TypeExamples
Transactional CRUD with joinsRelational (RDBMS)PostgreSQL, MySQL, Cloud SQL
Key-value lookups, high throughputKey-value storeDynamoDB, Bigtable, Cosmos DB
Full-text search, faceted queriesSearch engineOpenSearch, Elasticsearch
Hierarchical documents, flexible schemaDocument storeMongoDB, Firestore, DocumentDB
Relationships and graph traversalGraph databaseNeptune, Neo4j, JanusGraph
Time-series metrics, IoT dataTime-series DBTimescaleDB, InfluxDB, Timestream
Large file storage, media, backupsObject storageS3, GCS, Azure Blob
In-memory caching, session stateCacheRedis, Memcached, ElastiCache
Analytical queries, aggregationsColumnar / warehouseRedshift, BigQuery, Snowflake

Polyglot Architecture Example#

┌─────────────────────────────────────────────────────────────┐
│                     Booking Service                          │
│                                                              │
│  ┌──────────────┐  ┌──────────────┐  ┌──────────────────┐  │
│  │ PostgreSQL   │  │ Redis        │  │ OpenSearch       │  │
│  │              │  │              │  │                  │  │
│  │ Bookings,    │  │ Session      │  │ Full-text search │  │
│  │ Users,       │  │ cache,       │  │ across bookings, │  │
│  │ Transactions │  │ rate limits  │  │ faceted filters  │  │
│  └──────────────┘  └──────────────┘  └──────────────────┘  │
│                                                              │
│  ┌──────────────┐  ┌──────────────┐                         │
│  │ S3           │  │ DynamoDB     │                         │
│  │              │  │              │                         │
│  │ Booking PDFs,│  │ Activity     │                         │
│  │ photos,      │  │ log, audit   │                         │
│  │ attachments  │  │ trail        │                         │
│  └──────────────┘  └──────────────┘                         │
└─────────────────────────────────────────────────────────────┘

When NOT to Go Polyglot#

SituationRecommendation
Small team (< 5 engineers)Start with one database, add others only when bottlenecks prove it
Simple CRUD applicationPostgreSQL handles 95% of use cases
No one on the team knows the new databaseOperational complexity will eat your velocity
The performance problem is in the query, not the engineOptimise indexes before adding a new database

Data Gravity#

Data gravity is the principle that data attracts applications and services. Large datasets are expensive and slow to move, so applications tend to migrate toward data, not the other way around.

Implications for Architecture#

High Data Gravity                    Low Data Gravity
┌─────────────────────┐              ┌─────────────────────┐
│  10 TB data lake     │              │  100 MB config DB    │
│  in AWS us-east-1    │              │                     │
│                     │              │  Easy to replicate   │
│  Moving it = weeks  │              │  or move anywhere    │
│  + $900 egress      │              │                     │
│                     │              │                     │
│  → Applications     │              │  → Put it wherever   │
│    must come here   │              │    it's needed       │
└─────────────────────┘              └─────────────────────┘

Design rules:

  1. Co-locate compute with high-gravity data — move the code, not the data
  2. Factor egress costs into multi-region and multi-cloud decisions
  3. Use data replication for read-heavy workloads instead of cross-region queries
  4. Process data where it lives (edge computing, in-database analytics)

Data Mesh#

Data mesh is an organisational and architectural pattern that decentralises data ownership to domain teams rather than centralising it in a data engineering team.

Four Principles of Data Mesh#

PrincipleWhat It Means
Domain ownershipEach domain team owns, produces, and serves its data
Data as a productData is treated as a product with SLOs, documentation, and discoverability
Self-serve platformA central platform team provides infrastructure for domains to publish and consume data
Federated governanceGlobal standards for interoperability; local autonomy for domain-specific decisions

Data Mesh Architecture#

┌────────────────────────────────────────────────────────────────┐
│                    Data Mesh Platform                            │
│  ┌────────────┐  ┌────────────┐  ┌────────────┐               │
│  │ Data       │  │ Schema     │  │ Access      │               │
│  │ Catalogue  │  │ Registry   │  │ Control     │               │
│  └────────────┘  └────────────┘  └────────────┘               │
├────────────────────────────────────────────────────────────────┤
│                                                                 │
│  Bookings Domain          Search Domain          Payments Domain│
│  ┌─────────────────┐     ┌────────────────┐    ┌─────────────┐│
│  │ Bookings DB     │     │ Search Index   │    │ Payments DB ││
│  │ (operational)   │     │ (operational)  │    │ (operational)││
│  │                 │     │                │    │             ││
│  │ Bookings Data   │     │ Search Data    │    │ Payments    ││
│  │ Product:        │     │ Product:       │    │ Data Product││
│  │ • bookings.v1   │     │ • queries.v1   │    │ • txns.v1   ││
│  │ • SLO: 99.9%    │     │ • SLO: 99.5%   │    │ • SLO: 99.9%││
│  └─────────────────┘     └────────────────┘    └─────────────┘│
│                                                                 │
└────────────────────────────────────────────────────────────────┘

Data Mesh vs Centralised Data Team#

AspectCentralisedData Mesh
Data ownershipData engineering teamDomain teams
BottleneckData team is the bottleneckDomain teams are autonomous
Quality responsibilityCentral teamData producers
Best forSmall orgs, few domainsLarge orgs, many autonomous teams
RiskSingle team can’t understand all domainsInconsistency without governance

Data Sovereignty and Residency#

Data sovereignty dictates where data can be stored and processed based on regulatory requirements.

Common Regulations#

RegulationScopeKey Requirement
GDPR (EU)EU citizens’ personal dataData processing must have legal basis; data subject rights
Data Residency (various)Country-specificData must be stored within national borders
HIPAA (US)Health dataEncryption, access controls, BAA with provider
PCI DSSPayment card dataNetwork segmentation, encryption, audit logging
CCPA (California)California residentsRight to know, delete, opt-out of data sale

Architecture for Data Residency#

┌─────────────────────────────────────────────────┐
│              Global Application                   │
│                                                   │
│  Request arrives → Extract user's region          │
│         │                                         │
│         ├── EU user → Route to eu-west-1         │
│         │            (data stays in EU)           │
│         │                                         │
│         ├── US user → Route to us-east-1         │
│         │            (data stays in US)           │
│         │                                         │
│         └── APAC user → Route to ap-southeast-1  │
│                        (data stays in APAC)       │
│                                                   │
│  Metadata and non-PII → Replicated globally       │
│  PII and regulated data → Region-locked           │
└─────────────────────────────────────────────────┘

Storage Tiering#

Not all data needs the same performance or durability. Storage tiering matches data to the right cost/performance tier based on access frequency.

Tiering Strategy#

TierAccess FrequencyLatencyCostUse Case
HotMultiple times per dayMilliseconds$$$Active databases, caches, session data
WarmWeekly to monthlyMilliseconds$$Recent logs, recent backups, reports
ColdQuarterly or lessSeconds to minutes$Old logs, compliance archives, older backups
ArchiveRarely (legal hold)Hours¢7-year retention, legal discovery, audit

Lifecycle Policies#

Object created in S3 Standard (hot)
        │
        │ After 30 days, access drops
        ▼
Transition to S3 Infrequent Access (warm)
        │
        │ After 90 days, rarely accessed
        ▼
Transition to S3 Glacier Instant Retrieval (cold)
        │
        │ After 365 days, compliance only
        ▼
Transition to S3 Glacier Deep Archive (archive)
        │
        │ After 2555 days (7 years), regulatory period ends
        ▼
Delete (or retain if required)

Cross-Region Replication Patterns#

Replication Strategies#

StrategyConsistencyLatencyCostUse Case
Active-passiveEventualLow reads in primary regionLowDR, read replicas in secondary
Active-activeEventual or conflict resolutionLow reads everywhereHighGlobal users, low-latency everywhere
Active-readEventualLow reads in all regions, writes to primaryMediumGlobal reads, regional writes

Active-Active Architecture#

┌──────────────┐         ┌──────────────┐
│  EU Region   │◄───────►│  US Region   │
│              │  Async   │              │
│  App + DB    │  Repli-  │  App + DB    │
│  (read/write)│  cation  │  (read/write)│
└──────┬───────┘         └──────┬───────┘
       │                        │
       │    ┌──────────────┐    │
       └───►│ APAC Region  │◄──┘
            │              │
            │  App + DB    │
            │  (read/write)│
            └──────────────┘

Conflict resolution: Last-writer-wins (LWW)
or application-level merge logic

Conflict Resolution Approaches#

ApproachHow It WorksTrade-Off
Last-writer-wins (LWW)Timestamp-based; latest write winsSimple but loses data silently
Version vectorsTrack causal history; detect conflictsComplex, requires merge logic
Application-level mergeApp-specific logic resolves conflictsMost correct, most work
CRDTsMathematically guaranteed convergenceLimited data types, higher memory

Key Takeaways#

  • Use polyglot persistence: match the storage engine to the access pattern, but start simple and add complexity only when bottlenecks prove it
  • Data gravity is real — co-locate compute with large datasets and factor egress costs into multi-region decisions
  • Data mesh decentralises ownership to domain teams but requires a self-serve platform and federated governance
  • Data sovereignty is a hard constraint — know your regulatory requirements and design region-locked storage from the start
  • Storage tiering reduces costs by 60–90% for infrequently accessed data; automate transitions with lifecycle policies
  • Cross-region replication introduces conflict resolution complexity — active-passive is simpler and sufficient for most DR requirements