Skip to content

Storage

Storage is where the state of the system lives β€” and state is what makes systems hard. Compute can be replaced, restarted and multiplied freely; data must survive crashes, be read back correctly and stay consistent when many requests touch it at once. Each storage component in the palette answers a different question: where is the truth? (SQL Database), how does it survive a dead primary, and how much can it lose? (DB Cluster), how do I store huge volumes with simple access? (NoSQL DB), how do I avoid asking the database again? (Cache), where do big files go? (Object Store), how do I analyse history? (Data Warehouse), how do I find things by meaning? (Vector DB).

In BoxOffice, the seat inventory and the orders live in PostgreSQL (the truth, with transactions β€” no double booking); the catalog of events is read millions of times and sits behind a Redis cache; posters, venue maps and PDF tickets go to an object store; sales history flows into a data warehouse for the "best-selling artists" dashboard; and the support assistant finds the right FAQ answer through a vector index.

Component One-liner Playground id
SQL Database Relational tables, SQL, transactions: the default system of record sql
DB Cluster Replicated, optionally sharded database with automatic failover dbcluster
NoSQL DB Key-value, document or wide-column stores that partition horizontally nosql
Cache In-memory copy of hot data: sub-millisecond reads, offloads the database cache
Object Store Cheap, durable storage of files (blobs) by key, over HTTP objstore
Data Warehouse Columnar analytical store for large scans and aggregations (OLAP) dwh
Vector DB Stores embeddings and finds the nearest ones (similarity search) vectordb
flowchart LR
    APP[App Server] -->|hot reads| CACHE[Cache]
    APP -->|truth: seats, orders| SQL[SQL Database]
    APP -->|huge key-based data| NOSQL[NoSQL DB]
    APP -->|files: posters, tickets| OBJ[Object Store]
    SQL -->|CDC / ETL| DWH[Data Warehouse]
    APP -->|similarity search| VEC[Vector DB]

SQL Database

What it is. A relational database stores data in tables with a fixed schema, related by keys, queried with SQL, and protected by ACID transactions (atomicity, consistency, isolation, durability). It is the default system of record: the place where the truth lives. Indexes (usually B-trees) make lookups fast; the query planner chooses how to execute each query. To scale, you add read replicas (copies that serve reads, fed by the primary's log), connection pooling, and β€” much later β€” partitioning (sharding) or a distributed SQL engine.

When to use.

  • Data with relations and invariants: BoxOffice seats, holds, orders and payments β€” "a seat is sold at most once" is enforced by a transaction or a unique constraint.
  • When you need ad-hoc queries, joins, secondary indexes and reporting on current data.
  • As the starting point of almost every system: a single well-indexed PostgreSQL goes much further than most people expect.
  • Read-heavy workloads: add read replicas (scenario db-replicas) and a cache in front.

When not to (or watch out).

  • Write volume beyond one primary (millions of writes per second, e.g. location updates of every driver): partition, or use a store designed for it (NoSQL, event log).
  • Huge blobs (images, videos): store them in an object store and keep only the key in SQL.
  • Replicas scale reads, not writes, and they lag: a read right after a write may not see it (read-your-writes problem).
  • Long transactions and hot rows (every request updating the same counter) serialize the database.
  • Each connection costs memory: hundreds of app replicas Γ— a pool of 20 can exhaust the server β†’ use a pooler (PgBouncer).

Key numbers.

Metric Typical value Note
Indexed point query (primary key) β‰ˆ 0.1–1 ms on the server Plus a network round trip in the same zone (β‰ˆ 0.5 ms)
Throughput of one primary β‰ˆ thousands to tens of thousands of simple queries/s β‰ˆ illustrative; depends on hardware, query mix, indexes
Max connections hundreds per server (PostgreSQL default max_connections = 100) Use a connection pooler
Replication lag (async, same region) β‰ˆ milliseconds, seconds under heavy write load Grows with write volume
Failover to a standby (managed services) β‰ˆ 30 s to a few minutes β‰ˆ approximate; depends on the provider
Single-node data size that is comfortable up to a few TB Beyond that, partition or archive

Failure modes.

  • Primary failure β†’ standby with automatic failover (multi-AZ); clients must reconnect and retry idempotently.
  • Connection exhaustion β€” app replicas scale out and open too many connections β†’ pooler, smaller pools, limit autoscaling.
  • Slow query / missing index β€” one full scan saturates the CPU and every query slows β†’ EXPLAIN, indexes, query timeouts.
  • Lock contention / hot row β€” thousands of flash-sale requests updating the same rows β†’ short transactions, SELECT … FOR UPDATE SKIP LOCKED, a waiting-room queue in front.
  • Replication lag β†’ users don't see their own writes β†’ read from the primary after writes, or wait for the replica position.
  • Disk full / runaway table growth β†’ monitoring, retention policies, archiving to object storage.

In the playground. sql is a storage node with separate read and write capacities. readReplicas multiplies read capacity by (1 + replicas) while write capacity stays the same, and replication lag grows with the write load. Main parameters: capacity (default 3,000 reads/s; a write costs writeCost = 3 reads), latencyMs (median 4 ms), threads (200 connections), queueLimit (400), standby (multi-AZ failover); incoming edges can carry timeoutMs, retries and circuitBreaker. The client's read % decides how much the replicas help. Scenarios: monolith, db-replicas, read-heavy-cache, flash-sale, payment-system.

Real products.

  • Amazon RDS β€” managed PostgreSQL, MySQL, MariaDB, SQL Server and Oracle, with multi-AZ standby and read replicas.
  • Amazon Aurora β€” PostgreSQL/MySQL-compatible engine with a distributed storage layer and up to 15 read replicas.
  • Cloud SQL β€” managed PostgreSQL, MySQL and SQL Server.
  • AlloyDB for PostgreSQL β€” PostgreSQL-compatible, tuned for higher throughput and analytics.
  • Spanner β€” globally distributed SQL database with external consistency (TrueTime).
  • Azure Database for PostgreSQL (Flexible Server) and Azure Database for MySQL β€” managed open-source engines.
  • Azure SQL Database β€” managed SQL Server engine.
  • PostgreSQL β€” the course default: rich SQL, strong transactions, extensions (pgvector, PostGIS).
  • MySQL / MariaDB β€” widely used relational databases.
  • YugabyteDB β€” distributed SQL, PostgreSQL-compatible.
  • Vitess β€” sharding layer for MySQL (born at YouTube).
  • PgBouncer β€” lightweight connection pooler for PostgreSQL.

In the interview

"The source of truth for seats and orders is a relational database, because I need transactions to guarantee no double booking. I scale reads with replicas and a cache, keep writes on one primary with a standby for failover, and only shard when write volume or data size forces me to."

Learn more: Databases β€Ί Data models Β· Databases β€Ί Transactions Β· Databases β€Ί Replication Β· Case study: ticketing Β· Hands-on 1 Β· Hands-on 6


DB Cluster

What it is. A database run as a group of nodes instead of one server: each shard (a slice of the keys) has one primary that accepts the writes and followers that receive a copy of its log, and a cluster manager (or a consensus protocol such as Raft or Paxos) detects a dead primary and promotes a follower automatically. It adds what a single SQL Database node cannot give: read capacity from followers, write capacity from more shards, and survival of a node or zone failure. The two knobs every design must choose are how a write is acknowledged β€” async (the primary alone, fast, may lose the last writes on failover), sync (the primary plus one follower) or quorum (a majority of the shard's nodes) β€” and where reads go (primary only: always fresh; followers too: more capacity, possibly stale).

When to use.

  • Any system of record that must survive the loss of a machine or an availability zone without losing confirmed data: BoxOffice orders and payments.
  • Read-heavy workloads that outgrow one node: reads from followers (when a slightly stale answer is acceptable, e.g. the event catalog).
  • Write volume or data size beyond one primary: shard by a key with many distinct, evenly used values (event_id, user_id).
  • When the RPO (data you may lose) and RTO (time you may be down) are explicit requirements: they decide the replication mode and the failover mechanism.

When not to (or watch out).

  • Async replication loses data on failover: the writes still inside the replication lag when the primary dies are gone (RPO > 0). Use sync or quorum for money and seats.
  • Sync and quorum cost latency on every write (a round trip to a follower, often in another AZ); a single synchronous follower that becomes slow slows all writes β€” quorum tolerates one slow follower.
  • Followers lag: reading from them breaks read-your-writes β†’ read your own writes from the primary, or wait for the follower's position.
  • Sharding is hard to undo: cross-shard joins and transactions become expensive, and a hot key (one popular event) saturates its shard while the others idle.
  • Failover is not instant: detection plus promotion plus clients reconnecting is typically tens of seconds β€” the RTO.
  • Split brain: two nodes that both believe they are primary corrupt data β†’ consensus-based leader election, fencing.

Key numbers.

Metric Typical value Note
Replication round trip to a follower in another AZ β‰ˆ 1–2 ms β‰ˆ illustrative; added to every write with sync or quorum
Async replication lag (same region) β‰ˆ milliseconds; seconds under heavy write load Lost on failover with async: RPO β‰ˆ the lag at that moment
Automatic failover β‰ˆ 30 s (Aurora: typically under 30 s); β‰ˆ 60–120 s (RDS Multi-AZ instance) β‰ˆ approximate; detection + promotion + DNS/client reconnection
Patroni (PostgreSQL HA) leader lock ttl 30 s, loop_wait 10 s Documented defaults: a dead primary is replaced after β‰ˆ 30 s
Majority of a shard ⌊N/2βŒ‹ + 1 of N nodes 3 nodes tolerate 1 failure, 5 tolerate 2
Aurora storage 6 copies in 3 AZs; write quorum 4/6, read quorum 3/6 Survives the loss of an AZ plus one more copy
Theoretical availability of a 3-node shard 1 βˆ’ (1 βˆ’ 0.999)Β³ β‰ˆ 99.9999999% Ideal: ignores correlated failures, failover time and bugs

Failure modes.

  • Primary failure β€” writes to its shard fail until a follower is promoted (RTO); with async replication the last writes are lost (RPO) β†’ sync/quorum for critical data, idempotent client retries.
  • Slow synchronous follower β€” every write waits for it β†’ quorum instead of a single sync follower, alerts on replication latency.
  • Replication lag β†’ stale reads, users don't see their own writes β†’ read-your-writes routing, lag-aware load balancing, monitoring the lag.
  • Hot shard β€” skewed keys send most requests to one shard β†’ better shard key, split hot keys, cache in front.
  • Split brain β€” a network partition leaves two primaries β†’ consensus (Raft/Paxos), fencing tokens, majority-only writes.
  • No followers β€” a node failure means the shard is down until the node comes back β†’ at least one follower per shard in another AZ.

In the playground. dbcluster is a call node that models a replicated, optionally sharded database. Parameters (defaults in parentheses): shards (1; 1–64), replicasPerShard (2 followers per shard; 0–5), replication (async, or sync / quorum), readsFrom (followers, or primary), failoverS (30 s to detect a dead primary and promote a follower), replRttMs (2 ms replication round trip to a follower, cross-AZ, lognormal), capacity (3,000 reads/s per node), latencyMs (4 ms), threads (200 connections per node), writeCost (3: a write costs 3 reads of capacity) and price (450 USD/month per node, illustrative).

  • Capacity. Writes: shards Γ— capacity Γ· writeCost (only primaries write). Reads: shards Γ— (1 + replicasPerShard) Γ— capacity when reading from followers, shards Γ— capacity when reading from the primary. Keys are spread over the shards with the clients' Zipf skew: the hottest shard receives p₁ + (1 βˆ’ p₁)/shards of the requests (p₁ = share of the hottest key), so it saturates first; the inspector shows the utilization of the hot shard and of the others.
  • Write latency. async: the primary only. sync: + one round trip to the synchronous follower. quorum: + the round trip of the ⌊(R+1)/2βŒ‹-th fastest follower (a majority of the shard's 1 + R nodes) β€” so one slow follower hurts sync but not quorum. A latency degradation event on a DB Cluster slows one follower (the synchronous one) Γ—5–20.
  • Replication lag of the followers that are not part of the acknowledgement (all of them with async, R βˆ’ 1 with sync, R βˆ’ ⌊(R+1)/2βŒ‹ with quorum) grows with the primary's write utilization ρw, as for the SQL read replicas: lag β‰ˆ 0.02 s + 0.5 Β· ρwΒ³ Γ· (1 βˆ’ ρw) s, without bound above ρw = 1. Stale reads β‰ˆ share of reads served by lagging followers Γ— write share Γ— min(1, lag Γ· 1 s) (the playground assumes a client reads back what it wrote about one second later).
  • Primary failure (random with chaos, injectable with ⚑; an AZ outage also triggers one). The primary of one shard dies: writes to that shard β€” and reads too with readsFrom = primary β€” fail for failoverS (the RTO); then a follower is promoted and the shard runs with one node fewer until a replacement joins 120 s later. With async, the writes inside the replication lag at that moment are lost (lost writes β‰ˆ shard write rate Γ— lag; the report counts them β€” the RPO lesson); with sync or quorum, no writes are lost, at the price of higher write latency. With replicasPerShard = 0 there is no failover: the shard is down (reads and writes) for 120 s until the node comes back β€” no data lost, just unavailable.
  • Cost = shards Γ— (1 + replicasPerShard) Γ— price. Theoretical availability: per shard 1 βˆ’ (1 βˆ’ a)^(1+R) with a = 0.999 per node, all shards in series.

Scenarios: db-failover, db-replicas, sharding.

Real products.

  • Amazon Aurora β€” PostgreSQL/MySQL-compatible; quorum-replicated storage across 3 AZs, up to 15 readers, automatic failover; Aurora Limitless Database for sharding.
  • Amazon RDS Multi-AZ β€” a synchronous standby (instance) or two readable standbys (Multi-AZ DB cluster).
  • Amazon DynamoDB and Amazon DocumentDB β€” managed partitioned and replicated stores.
  • Cloud SQL with high availability β€” a synchronous standby in another zone.
  • AlloyDB for PostgreSQL β€” HA primary plus read pools.
  • Spanner β€” sharded (splits), Paxos-replicated SQL with external consistency.
  • Azure SQL Database (Business Critical / zone-redundant) and Azure Database for PostgreSQL with zone-redundant HA.
  • Azure Cosmos DB β€” partitioned, multi-region, with tunable consistency; Cosmos DB for PostgreSQL (Citus).
  • PostgreSQL with Patroni β€” streaming replication (async, sync or quorum ANY k) and automatic failover; Citus for sharding.
  • Vitess β€” sharding and failover for MySQL.
  • CockroachDB, YugabyteDB, TiDB β€” distributed SQL, Raft per range.
  • MongoDB replica sets + sharding (write concern majority).

In the interview

"The orders database is a cluster: a primary and two followers in different zones. Async replication is cheaper on every write but can lose the last writes on failover, so for orders and seats I use quorum (or sync) replication, which means zero data loss and one cross-zone round trip per write. Failover takes about 30 seconds β€” that's my RTO β€” and I shard by event only when one primary can't take the writes."

Learn more: Databases β€Ί Replication Β· Databases β€Ί Replication lag Β· Databases β€Ί Partitioning Β· Databases β€Ί Hot partitions Β· Databases β€Ί Transactions Β· Distributed β€Ί Consensus β€Ί Majorities Β· Distributed β€Ί CAP & PACELC Β· Reliability β€Ί Disaster recovery


NoSQL DB

What it is. "NoSQL" is a family of databases that give up some relational features (joins, multi-row transactions, a fixed schema) in exchange for horizontal scale and simple, predictable access by key. The main models are key-value (get/put by key), document (JSON documents with flexible fields), wide-column (rows with many columns, grouped by a partition key) and graph. Data is partitioned by a key (usually with consistent hashing) across many nodes and replicated β€” often with tunable consistency (quorums R + W > N). Many use LSM-trees, which make writes very fast.

When to use.

  • Very high write rates with simple access patterns: driver locations in ride sharing, chat messages, click streams, IoT readings.
  • Data that is naturally accessed by one key: user sessions, shopping carts, a user's timeline, a conversation's messages.
  • Predictable latency at any scale when you know the queries up front (you design the table for the query).
  • Flexible, evolving schemas (document stores) β€” e.g. event descriptions with different fields per event type.

When not to (or watch out).

  • Ad-hoc queries, joins and reporting: you can only query efficiently by the partition key (and maybe a sort key). New query = new table or index.
  • Multi-item invariants (no double booking across many rows): transactions are limited or absent in many stores.
  • The partition key decides everything: a bad key (e.g. event_id during the flash sale) concentrates the traffic on one partition β€” a hot partition β€” and the cluster's total capacity does not help.
  • Eventual consistency by default: a read may return an old value unless you ask for a stronger level.

Key numbers.

Metric Typical value Note
Single-key read/write latency β‰ˆ 1–10 ms At any table size, if the key is well distributed
Throughput scales roughly linearly with nodes/partitions Until a hot key concentrates load
DynamoDB item size limit 400 KB Documented limit
DynamoDB per-partition limit β‰ˆ 3,000 read units and 1,000 write units per second Documented; hence the hot-partition problem
Replication factor 3 is the usual choice Quorum: W = 2, R = 2

Failure modes.

  • Hot partition / hot key β€” a celebrity post or the flash-sale event receives most of the requests β†’ spread the key (add a suffix/shard number), cache it, or use a dedicated path.
  • Node failure β†’ replicas serve the data; hinted handoff and anti-entropy repair the missing writes later.
  • Stale reads under eventual consistency β†’ read with quorum or strong consistency when it matters.
  • Write conflicts in multi-leader/leaderless setups β†’ last-write-wins (loses data) or application merge; avoid for money.
  • Rebalancing storms when adding nodes β†’ consistent hashing with virtual nodes; add capacity before the peak.

In the playground. nosql is a storage node whose capacity is capacity Γ— replicas β€” each replica is a partition (defaults 5,000 ops/s Γ— 4). The client's zipfS (key popularity skew) concentrates a share of the traffic on one partition: with a hot key, the effective capacity drops to that of a single partition even though the others are idle. The chaos event "hot key / celebrity" makes the skew jump. Parameters: replicas, capacity, latencyMs (3 ms), writeCost (1.2). Scenarios: sharding, chat, ride-sharing, news-feed, url-shortener.

Real products.

  • Amazon DynamoDB β€” serverless key-value and document database with on-demand or provisioned capacity.
  • Amazon Keyspaces β€” managed Cassandra-compatible wide-column service.
  • Amazon DocumentDB β€” MongoDB-compatible document database.
  • Firestore β€” serverless document database.
  • Bigtable β€” wide-column store for very large, low-latency workloads (the system described in the Bigtable paper).
  • Azure Cosmos DB β€” multi-model, globally distributed database with five selectable consistency levels.
  • Apache Cassandra β€” leaderless wide-column store with tunable consistency (Dynamo-style).
  • MongoDB (Community Edition, source-available) β€” document database.
  • Apache HBase β€” wide-column store on top of HDFS (Bigtable-style).
  • FoundationDB β€” ordered key-value store with ACID transactions.

In the interview

"For billions of chat messages accessed by conversation, I'd use a wide-column store partitioned by conversation_id and sorted by time: writes scale with nodes and the main query hits one partition. The price is no joins and no ad-hoc queries, and I must watch for hot partitions."

Learn more: Databases β€Ί Data models Β· Databases β€Ί Partitioning Β· Distributed β€Ί Consistency Β· Case study: chat Β· Case study: URL shortener


Cache

What it is. A cache keeps a copy of frequently read data in memory, close to the code that needs it, so most reads skip the slower source (database, another service). The usual pattern is cache-aside: the app looks in the cache; on a hit it returns; on a miss it reads the database and stores the result with a TTL (time to live). Other patterns: read-through, write-through, write-behind, refresh-ahead. A distributed cache such as Redis is shared by all app replicas, survives app restarts and offers data structures (hashes, sorted sets, counters) that also make it useful for sessions, rate limiting and leaderboards.

When to use.

  • Read-heavy data that changes rarely or can be slightly stale: BoxOffice event catalog, venue details, prices for browsing.
  • Expensive results: rendered pages, aggregated counts, external API responses.
  • Shared ephemeral state: sessions, rate-limiter counters (token buckets), seat-map snapshots refreshed every second.
  • To protect the database from spikes: with a 95% hit ratio the database sees only 1/20 of the reads.

When not to (or watch out).

  • Data that must be exactly current at decision time β€” seat availability at purchase, account balance: the check must go to the source of truth.
  • Write-heavy data with few re-reads: the cache only adds work.
  • Invalidation is the hard part: decide how stale each item may be, and delete (not update) on writes.
  • A cache is not a database: it can be flushed, evicted or restarted empty. The system must survive a cold cache.

Key numbers.

Metric Typical value Note
Read from main memory β‰ˆ 100 ns "Latency numbers every programmer should know"
Redis GET over the network, same zone β‰ˆ 0.2–1 ms Mostly the network round trip
Throughput of one Redis node β‰ˆ 100k+ simple ops/s β‰ˆ illustrative; mostly single-threaded command execution
Database load with hit ratio h (1 βˆ’ h) Γ— reads 90% β†’ 99% hits = 10Γ— fewer DB reads
Average latency h Γ— t_cache + (1 βˆ’ h) Γ— t_db e.g. 0.95 Γ— 1 ms + 0.05 Γ— 20 ms β‰ˆ 2 ms
Common TTLs seconds (hot dynamic data) to hours (reference data) Add jitter to avoid synchronized expiry

Failure modes.

  • Cache stampede (thundering herd) β€” a hot key expires and thousands of misses hit the database at once β†’ request coalescing (single flight), a per-key lock, probabilistic early refresh, stale-while-revalidate, jittered TTLs.
  • Cold cache after a restart or flush β†’ warm up before taking traffic, protect the DB with rate limits, ramp traffic.
  • Hot key β€” one key (the flash-sale event) saturates one cache node β†’ local in-process cache for that key, replicate the key, split it.
  • Stale or inconsistent data β€” write races leave an old value β†’ delete on write, versioned keys, short TTLs.
  • Memory pressure / eviction β†’ right-size memory, choose the eviction policy (LRU, LFU), monitor the hit ratio and evictions.
  • Cache unavailable β†’ treat it as optional: fall back to the database with a circuit breaker and load shedding.

In the playground. cache is a cache node: each read hits with probability hitRatio and returns in β‰ˆ 0.5 ms; misses go to the next node (usually sql). Writes pass through to the database and invalidate; the policy parameter switches between cache-aside and write-through. Chaos events "cache flush / cold cache" drop the hit ratio to 0, which then warms back up over cacheWarmS (default 120 s) β€” watch the database turn red; coalescing stops the stampede. Parameters: hitRatio (0.9), policy, cacheWarmS, coalescing, capacity (80,000 ops/s), replicas. Scenarios: read-heavy-cache, url-shortener, search-autocomplete, news-feed, flash-sale.

Real products.

  • Amazon ElastiCache β€” managed Valkey, Redis OSS and Memcached.
  • Amazon MemoryDB β€” durable, Redis/Valkey-compatible in-memory database.
  • Memorystore β€” managed Valkey, Redis and Memcached.
  • Azure Cache for Redis / Azure Managed Redis β€” managed Redis.
  • Redis β€” the reference in-memory data-structure store (check the license of the version you use).
  • Valkey β€” Linux Foundation fork of Redis, BSD-licensed.
  • Memcached β€” simple, multi-threaded key-value cache.
  • Caffeine (Java) β€” high-performance in-process cache (W-TinyLFU eviction).

In the interview

"I'd put a cache-aside Redis in front of the catalog: with a 95% hit ratio the database sees 20Γ— fewer reads and p99 drops. Entries have a TTL with jitter, writes delete the key, and hot keys are protected against stampedes with request coalescing. Seat availability at purchase time never comes from the cache."

Learn more: Caching β€Ί Patterns Β· Caching β€Ί Invalidation Β· Caching β€Ί Failure modes Β· Caching β€Ί Redis Β· Case study: distributed cache Β· Hands-on 5


Object Store

What it is. An object store keeps files (objects, blobs) of any size in flat buckets, addressed by a key (posters/2027/coldplay.jpg) and accessed over HTTP (PUT, GET, DELETE, LIST). There are no directories, no in-place edits and no queries: you write a whole object and read it back. In exchange you get practically unlimited capacity, very high durability (data replicated across devices and zones), low price per GB and the ability to serve files directly to clients β€” usually through a CDN or with pre-signed URLs that grant temporary access.

When to use.

  • Media and documents: BoxOffice event posters, venue maps, generated PDF tickets, user uploads.
  • Video: original uploads and transcoded segments, served through a CDN (scenario video-streaming).
  • Backups, database snapshots, logs archives, data-lake files (Parquet) read by the data warehouse.
  • Static website hosting (the SPA front end) as the CDN's origin.

When not to (or watch out).

  • Small records that change often or need queries: that is a database.
  • Low-latency random access within a file, or appends: objects are written whole.
  • Do not stream large uploads through your app servers: let clients upload directly with a pre-signed URL.
  • Costs hide in requests (per thousand PUT/GET) and egress (per GB leaving the cloud), not only in storage.
  • Bucket permissions: public buckets by mistake are a classic data leak.

Key numbers.

Metric Typical value Note
Designed durability (Amazon S3 Standard) 99.999999999% ("11 nines") per year Documented design target
Time to first byte β‰ˆ 10–100 ms Use a CDN for user-facing reads
S3 request rate per prefix 3,500 writes/s and 5,500 reads/s Documented; scale by spreading keys over prefixes
Object size from bytes to terabytes Large objects use multipart upload
Storage price β‰ˆ USD 0.02 per GB-month (standard class) β‰ˆ approximate (2026); colder classes are cheaper to store, pricier to read

Failure modes.

  • Accidental public exposure β†’ block public access by default, serve through CDN with origin access control, pre-signed URLs.
  • Accidental deletion / overwrite β†’ versioning, object lock, lifecycle policies, cross-region replication for critical data.
  • Request throttling on one prefix β†’ spread keys (hash prefix), cache hot objects in the CDN.
  • Cost surprise β€” egress or millions of tiny requests β†’ CDN in front, batch small objects, lifecycle to cheaper classes.
  • Regional outage β†’ cross-region replication for the data you cannot lose.

In the playground. objstore is a storage node with high capacity and a higher median latency than a database; it usually sits behind a cdn (the origin) or receives writes from worker nodes (transcoding). Cost is per GB and per request. Parameter: latencyMs (median 30 ms); its capacity (200,000 req/s) is practically unlimited. Scenarios: video-streaming, cdn-static.

Real products.

  • Amazon S3 β€” the reference object store; storage classes from Standard to Glacier Deep Archive.
  • Cloud Storage β€” object storage with Standard, Nearline, Coldline and Archive classes.
  • Azure Blob Storage β€” object storage with hot, cool, cold and archive tiers.
  • MinIO β€” S3-compatible object store (check the license and edition).
  • Ceph (RADOS Gateway) β€” distributed storage with an S3-compatible interface.
  • SeaweedFS β€” distributed object/file store for many small files.

In the interview

"Posters and tickets go to an object store, never to the database: it's cheap, practically infinite and extremely durable. Clients upload directly with pre-signed URLs and download through the CDN, so the app servers never carry the bytes; the database keeps only the object key and metadata."

Learn more: Databases β€Ί Specialized stores Β· Edge β€Ί DNS & CDN Β· Case study: video streaming


Data Warehouse

What it is. A data warehouse is an analytical (OLAP) database built for queries that scan and aggregate large amounts of history β€” "revenue per artist per month in 2026" β€” rather than for many small transactions (OLTP). It stores data by column (so a query reads only the columns it needs, highly compressed), separates storage from compute, and runs queries in parallel over many machines. Data arrives from the operational databases and event streams through ETL/ELT jobs or change data capture (CDC). A lakehouse keeps the data as open files (Parquet + a table format such as Apache Iceberg) in an object store and queries them with warehouse engines.

When to use.

  • Business analytics and dashboards: sales per event, conversion of the waiting room, fraud patterns, cohort analysis.
  • Questions over months or years of data, joining many sources (orders, payments, marketing, support).
  • Feeding machine-learning features and reports without loading the production database.
  • The analytics service of the palette usually writes here (via a stream or batch jobs).

When not to (or watch out).

  • Serving the product: queries take seconds, not milliseconds, and concurrency is limited β€” never put the warehouse on the request path of a user.
  • Point updates and small transactions: they are slow and expensive in columnar engines.
  • Freshness: batch ETL makes data hours old; for near-real-time, use CDC/streaming ingestion, at a higher cost.
  • Pay-per-scan pricing: an unfiltered SELECT * on a huge table costs real money β€” partition and cluster tables, select only needed columns.

Key numbers.

Metric Typical value Note
Query latency β‰ˆ seconds to minutes Interactive dashboards target a few seconds
Scan throughput β‰ˆ GB/s to TB/s across a cluster β‰ˆ illustrative; grows with compute
Columnar compression often β‰ˆ 5–10Γ— β‰ˆ illustrative; depends on data
Freshness batch: hours; streaming/CDC: seconds to minutes Trade-off: cost vs freshness
On-demand pricing (BigQuery) β‰ˆ USD 6 per TiB scanned β‰ˆ approximate list price (2026); flat-rate options exist

Failure modes.

  • Analytics on the production database β€” a heavy report slows checkout β†’ move analytics to a replica or, better, to the warehouse.
  • Broken or late pipelines β€” dashboards silently show yesterday's data β†’ data-freshness checks, alerting on pipeline lag.
  • Schema drift β€” a column renamed in the source breaks the ETL β†’ schema registry / contracts, CDC with schema evolution.
  • Runaway query cost β†’ partitioned tables, cost limits per query/user, materialized aggregates.
  • Duplicates from at-least-once ingestion β†’ idempotent loads (merge by key), deduplication.

In the playground. dwh is a storage node off the critical path: it typically receives an async flow from a stream/kafka node or from analytics, so its latency does not affect the user's p99, but its backlog and cost are visible. Parameters: replicas, capacity (20 queries/s), latencyMs (median 2 s). Scenarios: event-fanout, observability-stack.

Real products.

  • Amazon Redshift β€” columnar data warehouse (provisioned or serverless).
  • Amazon Athena β€” serverless SQL over files in S3.
  • BigQuery β€” serverless data warehouse with storage/compute separation.
  • Microsoft Fabric (Data Warehouse, Lakehouse) and Azure Synapse Analytics β€” analytics platforms.
  • Azure Databricks β€” Spark-based lakehouse platform.
  • ClickHouse β€” very fast columnar OLAP database.
  • Apache Spark β€” distributed batch and streaming processing.
  • Trino β€” distributed SQL query engine over lakes and databases.
  • Apache Iceberg β€” open table format for lakehouses.
  • DuckDB β€” in-process analytical database, great for local analysis.

In the interview

"Analytics never runs on the production database. Order events flow through Kafka (or CDC from the outbox) into a columnar warehouse, where dashboards scan months of history in seconds. The trade-off is freshness β€” minutes, not milliseconds β€” which is fine for business reports."

Learn more: Databases β€Ί Specialized stores Β· Messaging β€Ί Patterns Β· Compute β€Ί Services Β· Analytics service


Vector DB

What it is. A vector database stores embeddings β€” arrays of numbers (typically a few hundred to a few thousand dimensions) produced by a model so that texts or images with similar meaning end up close together β€” and answers nearest-neighbour queries: "the 5 chunks most similar to this question". Exact search compares against every vector, which is too slow at scale, so vector stores use approximate nearest neighbour (ANN) indexes such as HNSW (a navigable graph) or IVF (clusters), trading a little recall for orders of magnitude of speed. Most also filter by metadata (e.g. only documents of this event) and combine vector with keyword search (hybrid search).

When to use.

  • RAG (retrieval-augmented generation): the BoxOffice support assistant retrieves the most relevant FAQ and policy chunks and puts them in the LLM prompt.
  • Semantic search ("concerts like this one"), recommendations, deduplication of near-identical content.
  • The semantic cache of an LLM gateway: reuse an answer when a new question is close enough to a previous one.
  • Long-term memory of agents (the palette's memory component uses it).

When not to (or watch out).

  • Exact matches, filters and transactions: a SQL index or a search engine is better and cheaper.
  • Small collections (thousands of vectors): an extension in your existing database (pgvector) is enough β€” no new system to operate.
  • ANN is approximate: recall below 100% means some relevant chunks are missed; evaluate retrieval quality, not just latency.
  • Changing the embedding model means re-embedding everything: version your embeddings.
  • Memory: HNSW indexes are large and usually kept in RAM.

Key numbers.

Metric Typical value Note
Embedding dimensions β‰ˆ 384–3,072 Depends on the model
Size of one vector dims Γ— 4 bytes (float32) 1,536 dims β‰ˆ 6 KB; 1 M vectors β‰ˆ 6 GB before index overhead
ANN query latency β‰ˆ 1–10 ms for millions of vectors β‰ˆ illustrative; depends on index parameters and hardware
Recall@10 with tuned HNSW β‰ˆ 0.9–0.99 Trade-off with latency and memory
Quantization savings β‰ˆ 4Γ— (int8) to 32Γ— (binary) less memory At some loss of recall

Failure modes.

  • Poor retrieval β€” the right chunk is not in the top-k β†’ better chunking, hybrid search, reranking, evaluation sets.
  • Stale index β€” documents changed but embeddings did not β†’ re-index on change (CDC/events), track versions.
  • Model mismatch β€” query and documents embedded with different models β†’ store the model version with each vector.
  • Memory exhaustion as the collection grows β†’ quantization, sharding, disk-based indexes.
  • Data leakage across tenants β†’ mandatory metadata filters (tenant, permissions) applied in the query, not in the prompt.

In the playground. vectordb is a storage node usually called by memory (Memory Fabric) or by the orchestrator in the AI scenario; its latency adds to every agent step that retrieves context. Parameters: replicas, capacity (1,500 queries/s), latencyMs (median 12 ms). Scenarios: ai-assistant, search-autocomplete.

Real products.

  • Amazon OpenSearch Service β€” k-NN vector search plus keyword search.
  • Amazon Aurora PostgreSQL / RDS for PostgreSQL with the pgvector extension.
  • Vertex AI Vector Search β€” managed ANN service.
  • AlloyDB / Cloud SQL for PostgreSQL with pgvector.
  • Azure AI Search β€” vector, keyword and hybrid search.
  • Azure Cosmos DB β€” integrated vector search.
  • pgvector β€” vector type and HNSW/IVFFlat indexes inside PostgreSQL (used in Hands-on 12).
  • Qdrant, Milvus, Weaviate β€” dedicated vector databases.
  • FAISS β€” library for efficient similarity search (Meta).
  • Chroma β€” lightweight embedding store for prototypes.

In the interview

"For RAG over BoxOffice's policies, I'd chunk the documents, embed them and store the vectors in pgvector next to the data we already have, with an HNSW index and a tenant filter. A dedicated vector database only pays off at tens of millions of vectors; either way, I measure retrieval recall, not just latency."

Learn more: Databases β€Ί Specialized stores Β· AI systems β€Ί RAG & memory Β· Case study: AI assistant Β· Memory Fabric Β· Hands-on 12