DBRaven
Full ReviewModerate Readinessdraft

Architecture Review: Streaming Media Platform

A video and audio streaming architecture where content ingestion triggers an async multi-variant transcoding pipeline, CDN delivery handles 95%+ of playback traffic, and Cassandra absorbs the write volume of per-user viewing history. Kafka decouples upload events from transcoding workers; MinIO stores raw and encoded assets; Redis maintains playback session state and view counters. The architecture must handle upload spikes without blocking delivery, and cache cold starts without cascading database load.

Evidence Confidence

Moderate

strong

Executive Summary

Streaming Media Platform: moderate operational readiness (81% evidence confidence). 0 architectural strengths identified, 6 operational risks to manage. Primary concern: Queue Backlog Accumulation. Requires Advanced operational maturity.

Readiness Rationale

Overall moderate readiness across 8 dimensions. Limited: team maturity. Strong: migration, observability, failure recovery.

Key Concerns

  • !Queue Backlog Accumulation
  • !Thundering Herd (Cache Stampede)

Key Strengths

  • +Architecture is well-defined for the event driven system problem profile

8

Assessments

4

Tradeoffs

6

Sections

11

Recommendations

Readiness Assessments

8

Architectural Tradeoffs

4

Recommendations

11
High

Monitor: Queue Backlog Accumulation

risk_monitoring

Message queue or event stream consumer processing rate falls below producer write rate, causing consumer lag to grow unboundedly: eventually leading to increased end-to-end latency, producer backpressure, data expiry, or queue resource exhaustion.

Affects 2 nodes. (Event Streaming, Slow Consumer)

High

Monitor: Thundering Herd (Cache Stampede)

risk_monitoring

When a popular cached key expires or a service recovers from downtime, all requests that were waiting or arrive simultaneously miss the cache and hit the origin database concurrently, producing a request spike that can overwhelm the database within seconds.

Affects 1 node. (Redis)

High

Implement: Monitor queue backlog signals

observability

Seed 'Queue Consumer Backlog' identifies 4 metrics relevant to queue_backlog_accumulation.

Metrics to instrument: queue_depth, consumer_lag_seconds, consumer_throughput

Moderate

Synchronous transcoding in the upload request handler (blocking API response) → Async transcoding via Kafka topic with competing consumer workers

migration_planning

Trigger: Upload API p99 exceeding 30 seconds due to in-process transcoding blocking the response; upload timeouts reported by client applications during large file uploads. Migrate from 'Synchronous transcoding in the upload request handler (blocking API response)' to 'Async transcoding via Kafka topic with competing consumer workers'. Accept the upload, write the raw asset to MinIO, publish a transcoding_requested event to Kafka, and return 202 Accepted immediately. Status polling or webhook callbacks communicate availability. This is the correct model from day one for any content > a few megabytes.

Clients must handle the content-available state transition asynchronously : polling or webhook delivery of transcoding completion is required and must be built before removing synchronous behavior; Duplicate transcoding jobs if the Kafka producer retries without idempotency configured: implement idempotent producer and deduplication by upload_id at the worker to prevent wasted compute on duplicate work

Moderate

Viewing history in PostgreSQL → Viewing history in Cassandra

migration_planning

Trigger: PostgreSQL viewing history table exceeding 500M rows; write latency on history inserts affecting OLTP transaction throughput on the shared primary; history queries scanning large time ranges causing sequential scan pressure. Migrate from 'Viewing history in PostgreSQL' to 'Viewing history in Cassandra'. Model the Cassandra schema around the three or four concrete read patterns (user's history ordered by time, content's viewer list, resume position by user+content). Everything else goes to an analytics pipeline, not Cassandra.

Cassandra schema must encode all required query access patterns at design time; ad-hoc queries that were easy in PostgreSQL SQL require pre-defined tables in Cassandra; Migration requires a dual-write period with history being written to both stores simultaneously; validating equivalence before decommissioning PostgreSQL history is non-trivial at high write volume

Moderate

Prepare runbook for: Burst Traffic Cold Cache Stampede

simulation_preparedness

Simulation demonstrates critical degradation of redis, postgresql

Without a runbook, recovery from this failure mode will be ad-hoc

burst-traffic-cold-cache-stampede
Moderate

Prepare runbook for: Connection Pool Exhaustion with Horizontal User Scale

simulation_preparedness

Simulation demonstrates critical degradation of postgresql

Without a runbook, recovery from this failure mode will be ad-hoc

connection-pool-growth-with-user-scale
Moderate

Plan evolution: OLTP Analytics Queries → OLTP + OLAP Separation

evolution_planning

Evolution from Unified OLTP + Analytics on PostgreSQL → Separated OLTP (PostgreSQL) + OLAP (ClickHouse/Snowflake)

Migration complexity: medium. Rollback: always.

oltp-analytics-to-separated
Moderate

Plan evolution: Single Cache Layer → Distributed Cache

evolution_planning

Evolution from Single Redis Node / Sentinel Cluster → Distributed Redis Cluster (Consistent Hash Ring)

Migration complexity: medium. Rollback: complex.

single-cache-to-distributed
Low

Monitor threshold: Tier 1: Transcoding Worker Throughput

scaling_monitoring

Signal: Kafka consumer group lag on the transcoding topic growing during peak upload hours; content availability delay > 10 minutes for newly uploaded videos; transcoding worker CPU consistently above 85% across all instances

Bottleneck: Transcoding consumer group undersized relative to peak upload volume. Evolution: Increase transcoding consumer instances up to the transcoding topic partition count; tune partition count to match the maximum desired worker parallelism (set this at topic creation, not after lag appears); implement per-uploader upload rate limits to smooth burst input; consider priority queuing so premium-tier content does not wait behind bulk ingest jobs

Low

Monitor threshold: Tier 2: CDN Origin Thundering Herd

scaling_monitoring

Signal: MinIO GET request rate spikes > 10x baseline immediately after content publish or CDN invalidation; MinIO p99 latency > 500ms; CDN miss ratio > 5% on popular content

Bottleneck: CDN cache miss storm on first-play of new or recently-updated content. Evolution: Implement origin request coalescing (single origin fetch per CDN node per object, queue subsequent requestors for the in-flight response); pre-warm CDN edges for anticipated high-traffic content before publish; add rate limiting at the origin gateway to cap per-second origin requests per content_id

Scaling Pressure Signals

8

Kafka consumer group lag on the transcoding topic growing during peak upload hours; content availability delay > 10 minutes for newly uploaded videos; transcoding worker CPU consistently above 85% across all instances

Threshold

Tier 1: Transcoding Worker Throughput

Likely Bottleneck

Transcoding consumer group undersized relative to peak upload volume

Recommended Evolution

Increase transcoding consumer instances up to the transcoding topic partition count; tune partition count to match the maximum desired worker parallelism (set this at topic creation, not after lag appears); implement per-uploader upload rate limits to smooth burst input; consider priority queuing so premium-tier content does not wait behind bulk ingest jobs

Evidence:kafka-consumer-lag-cascadepartition-hotspot-amplification

MinIO GET request rate spikes > 10x baseline immediately after content publish or CDN invalidation; MinIO p99 latency > 500ms; CDN miss ratio > 5% on popular content

Threshold

Tier 2: CDN Origin Thundering Herd

Likely Bottleneck

CDN cache miss storm on first-play of new or recently-updated content

Recommended Evolution

Implement origin request coalescing (single origin fetch per CDN node per object, queue subsequent requestors for the in-flight response); pre-warm CDN edges for anticipated high-traffic content before publish; add rate limiting at the origin gateway to cap per-second origin requests per content_id

Cassandra node CPU imbalance > 40% across cluster; write latency p99 spiking on specific nodes; nodetool tpstats showing dropped mutations on hot nodes

Threshold

Tier 3: Cassandra Partition Hot Spot

Likely Bottleneck

Viewing history writes concentrating on a small number of Cassandra partitions for viral content

Recommended Evolution

Add a write_bucket component to the partition key (e.g., content_id + time bucket modulo N) to distribute writes across N partitions per content_id; tune N based on expected peak write rate per content item; read queries must fan out across all N buckets and merge, which increases read complexity but eliminates write hotspots

Evidence:kafka-consumer-lag-cascadepartition-hotspot-amplification

Playback start latency > 2s for users > 100ms RTT from origin; CDN miss rate growing due to content catalog size exceeding CDN edge cache capacity; regulatory requirements for content localization or data residency in specific regions

Threshold

Tier 4: Multi-Region Delivery Reach

Likely Bottleneck

Single-region origin serving global playback volume with CDN as the only latency buffer

Recommended Evolution

Deploy regional MinIO object storage with asynchronous replication of popular content to regional origins; implement geo-routing at the CDN layer to direct playback requests to the nearest origin; Kafka multi-region replication for transcoding event propagation to regional worker fleets

Kafka consumer group lag on the transcoding topic growing during peak upload hours; content availability delay > 10 minutes for newly uploaded videos; transcoding worker CPU consistently above 85% across all instances

Threshold

Escalation trigger: Transcoding consumer group undersized relative to peak upload volume

Likely Bottleneck

Tier 1: Transcoding Worker Throughput

Recommended Evolution

Monitor: queue_depth, consumer_lag_seconds, consumer_throughput

MinIO GET request rate spikes > 10x baseline immediately after content publish or CDN invalidation; MinIO p99 latency > 500ms; CDN miss ratio > 5% on popular content

Threshold

Escalation trigger: CDN cache miss storm on first-play of new or recently-updated content

Likely Bottleneck

Tier 2: CDN Origin Thundering Herd

Recommended Evolution

Monitor: queue_depth, consumer_lag_seconds, consumer_throughput

Cassandra node CPU imbalance > 40% across cluster; write latency p99 spiking on specific nodes; nodetool tpstats showing dropped mutations on hot nodes

Threshold

Escalation trigger: Viewing history writes concentrating on a small number of Cassandra partitions for viral content

Likely Bottleneck

Tier 3: Cassandra Partition Hot Spot

Recommended Evolution

Monitor: queue_depth, consumer_lag_seconds, consumer_throughput

Playback start latency > 2s for users > 100ms RTT from origin; CDN miss rate growing due to content catalog size exceeding CDN edge cache capacity; regulatory requirements for content localization or data residency in specific regions

Threshold

Escalation trigger: Single-region origin serving global playback volume with CDN as the only latency buffer

Likely Bottleneck

Tier 4: Multi-Region Delivery Reach

Recommended Evolution

Monitor: queue_depth, consumer_lag_seconds, consumer_throughput

Migration Readiness

12

Migration Stages

3
Stage

Synchronous transcoding in the upload request handler (blocking API response) → Async transcoding via Kafka topic with competing consumer workers

info

Migration trigger: Upload API p99 exceeding 30 seconds due to in-process transcoding blocking the response; upload timeouts reported by client applications during large file uploads

Stage

Viewing history in PostgreSQL → Viewing history in Cassandra

info

Migration trigger: PostgreSQL viewing history table exceeding 500M rows; write latency on history inserts affecting OLTP transaction throughput on the shared primary; history queries scanning large time ranges causing sequential scan pressure

Stage

Single CDN provider with no origin rate limiting → Multi-CDN with origin request coalescing and rate limiting

info

Migration trigger: CDN provider incident causing total origin failover; CDN miss rate increasing as content catalog grows; origin costs growing unsustainably due to cache bypass on content updates

!

Risks

9
Risk

Clients must handle the content-available state transition a

warning

Clients must handle the content-available state transition asynchronously : polling or webhook delivery of transcoding completion is required and must be built before removing synchronous behavior

Risk

Duplicate transcoding jobs if the Kafka producer retries wit

warning

Duplicate transcoding jobs if the Kafka producer retries without idempotency configured: implement idempotent producer and deduplication by upload_id at the worker to prevent wasted compute on duplicate work

Risk

Cassandra schema must encode all required query access patte

warning

Cassandra schema must encode all required query access patterns at design time; ad-hoc queries that were easy in PostgreSQL SQL require pre-defined tables in Cassandra

Risk

Migration requires a dual-write period with history being wr

warning

Migration requires a dual-write period with history being written to both stores simultaneously; validating equivalence before decommissioning PostgreSQL history is non-trivial at high write volume

Risk

Multi-CDN routing adds DNS TTL and routing decision complexi

warning

Multi-CDN routing adds DNS TTL and routing decision complexity: ensure CDN health checks are active and routing failover is tested under simulated provider outage conditions

Risk

Request coalescing at the origin layer must be implemented i

warning

Request coalescing at the origin layer must be implemented in the serving infrastructure (nginx, Varnish, or CDN itself): application-layer coalescing is insufficient at playback-scale request rates

Risk

Projection lag creates a read-after-write window where users

critical

Projection lag creates a read-after-write window where users see stale data after their own writes. Mitigation: Route immediate post-write reads to the write store (session-scoped write token); accept eventual consistency only for non-user-initiated reads

direct-db-to-cqrs

Risk

Projection rebuild after schema change can take hours or day

critical

Projection rebuild after schema change can take hours or days on large datasets. Mitigation: Design blue/green projection deployment: build new projection in parallel before switching traffic; test rebuild time in staging

direct-db-to-cqrs

Risk

Cross-service workflows that previously used database transa

critical

Cross-service workflows that previously used database transactions now require Saga orchestration. Mitigation: Design idempotent event handlers; implement compensating transactions for every multi-step workflow; test failure injection in staging

modular-monolith-to-event-driven

Review Sections

6

Referenced Intelligence

cassandrakafkaminiopostgresqlredisburst-traffic-cold-cache-stampedeconnection-pool-growth-with-user-scalecqrs-projection-lag-expansioncross-region-stale-read-windowdistributed-cache-invalidation-failureevent-replay-storm-recoverykafka-consumer-lag-cascademulti-tenant-noisy-neighborpartition-hotspot-amplificationpostgresql-replication-lag-surgequery-cost-without-indexesread-amplification-n-plus-one-queriesredis-cache-collapse-stampederetry-storm-amplificationsplit-brain-during-network-partitionstorage-bloat-without-archivingstorage-cost-compounding-without-retentionwrite-heavy-bulk-import-saturationdirect-db-to-cqrsmodular-monolith-to-event-drivenoltp-analytics-to-separatedpostgresql-to-partitionedrabbitmq-to-kafkasingle-cache-to-distributedsingle-region-to-multi-regionarchitecture-evolutionauditabilitybtree-indexingcache-invalidationcap-theoremconsistency-modelscqrs-operationalevent-sourcingeventual-consistencykafka-consumer-lagmulti-tenancynormalizationoltp-vs-olappartition-hotspotsquery-planningqueue-backlogreplication-lagvector-databaseswrite-amplification
Architecture Review: Streaming Media Platform: DBRaven