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
8Architectural Tradeoffs
4Recommendations
11Monitor: Queue Backlog Accumulation
risk_monitoringMessage 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)
Monitor: Thundering Herd (Cache Stampede)
risk_monitoringWhen 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)
Implement: Monitor queue backlog signals
observabilitySeed 'Queue Consumer Backlog' identifies 4 metrics relevant to queue_backlog_accumulation.
Metrics to instrument: queue_depth, consumer_lag_seconds, consumer_throughput
Synchronous transcoding in the upload request handler (blocking API response) → Async transcoding via Kafka topic with competing consumer workers
migration_planningTrigger: 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
Viewing history in PostgreSQL → Viewing history in Cassandra
migration_planningTrigger: 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
Prepare runbook for: Burst Traffic Cold Cache Stampede
simulation_preparednessSimulation demonstrates critical degradation of redis, postgresql
Without a runbook, recovery from this failure mode will be ad-hoc
Prepare runbook for: Connection Pool Exhaustion with Horizontal User Scale
simulation_preparednessSimulation demonstrates critical degradation of postgresql
Without a runbook, recovery from this failure mode will be ad-hoc
Plan evolution: OLTP Analytics Queries → OLTP + OLAP Separation
evolution_planningEvolution from Unified OLTP + Analytics on PostgreSQL → Separated OLTP (PostgreSQL) + OLAP (ClickHouse/Snowflake)
Migration complexity: medium. Rollback: always.
Plan evolution: Single Cache Layer → Distributed Cache
evolution_planningEvolution from Single Redis Node / Sentinel Cluster → Distributed Redis Cluster (Consistent Hash Ring)
Migration complexity: medium. Rollback: complex.
Monitor threshold: Tier 1: Transcoding Worker Throughput
scaling_monitoringSignal: 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
Monitor threshold: Tier 2: CDN Origin Thundering Herd
scaling_monitoringSignal: 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
8Kafka 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
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
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
12Migration Stages
3Synchronous transcoding in the upload request handler (blocking API response) → Async transcoding via Kafka topic with competing consumer workers
infoMigration 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
Viewing history in PostgreSQL → Viewing history in Cassandra
infoMigration 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
Single CDN provider with no origin rate limiting → Multi-CDN with origin request coalescing and rate limiting
infoMigration 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
9Clients must handle the content-available state transition a
warningClients 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 wit
warningDuplicate 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
Cassandra schema must encode all required query access patte
warningCassandra 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 wr
warningMigration 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
Multi-CDN routing adds DNS TTL and routing decision complexi
warningMulti-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
Request coalescing at the origin layer must be implemented i
warningRequest 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
Projection lag creates a read-after-write window where users
criticalProjection 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
Projection rebuild after schema change can take hours or day
criticalProjection 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
Cross-service workflows that previously used database transa
criticalCross-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
6Referenced Intelligence