Architecture Review: Analytics Data Platform
An OLAP-oriented analytics architecture that ingests operational changes from PostgreSQL via WAL-based CDC into Kafka, then routes them to a columnar analytics store (ClickHouse or Snowflake) for product analytics, business intelligence, and operational reporting. The CQRS separation ensures analytical queries never degrade transactional write performance, and materialized views provide pre-aggregated query acceleration for the most expensive analytical patterns.
Evidence Confidence
Moderate
moderate
Executive Summary
Analytics Data Platform: moderate operational readiness (79% evidence confidence). 4 architectural strengths identified, 3 operational risks to manage. Primary concern: Hot Partition. Requires Advanced operational maturity.
Readiness Rationale
Overall moderate readiness across 8 dimensions. Limited: team maturity. Strong: operational, migration, observability.
Key Concerns
- !Hot Partition
- !Queue Backlog Accumulation
Key Strengths
- +Analytics-heavy workloads pre-compute expensive aggregations and joins into materialized views, reducing repeated full-scan query…
- +ClickHouse's columnar storage engine, vectorized query execution, and MergeTree family of table engines are specifically designed…
- +Kafka is the standard downstream target for WAL-based CDC pipelines: Debezium captures database WAL records and publishes them to…
- +CQRS separates the write model (normalized, ACID) from the read model; materialized views implement the read model by…
8
Assessments
2
Tradeoffs
6
Sections
11
Recommendations
Readiness Assessments
8Architectural Tradeoffs
2Recommendations
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 1 node. (Slow Consumer)
Monitor: Hot Partition
risk_monitoringOne partition (a database shard, a Kafka topic partition, a Redis hash slot) receives traffic so far above its peers that it saturates while the others sit idle. Aggregate capacity looks healthy, but the hot partition throttles or lags, and everything routed to it degrades. The cause is skew in how keys map to partitions, and the fix depends on whether the skew is spread across many keys or concentrated in one.
Affects 0 nodes
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
Analytics queries running directly against PostgreSQL OLTP primary → Read replica serving analytics queries via polling ETL
migration_planningTrigger: OLTP query p99 degrading during analytics reporting windows; reporting queries showing wait events (LockTimeout, I/O wait) in pg_stat_activity. Migrate from 'Analytics queries running directly against PostgreSQL OLTP primary' to 'Read replica serving analytics queries via polling ETL'. Polling ETL from a read replica is a practical first step. It separates analytics load from the primary without committing to Kafka infrastructure.
Read replica replication lag degrades freshness during heavy OLTP write periods; ETL polling creates a minimum latency floor; sub-minute freshness is not achievable
Polling ETL from read replica to analytics store → WAL CDC → Kafka → ClickHouse streaming ingestion
migration_planningTrigger: Sub-minute analytics freshness SLA required; ETL scheduling overhead growing; analytics volume exceeding what the read replica can serve under polling load. Migrate from 'Polling ETL from read replica to analytics store' to 'WAL CDC → Kafka → ClickHouse streaming ingestion'. This migration delivers streaming freshness and isolates analytics infrastructure from the OLTP layer. Validate CDC slot monitoring and alerting before migrating high-volume tables.
CDC setup requires PostgreSQL logical replication slot: mandatory monitoring obligation from day one; ClickHouse operational model (parts, merges, insert buffering) requires learning investment
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: PostgreSQL → Partitioned PostgreSQL
evolution_planningEvolution from Single-Node PostgreSQL → Partitioned PostgreSQL
Migration complexity: high. Rollback: rarely.
Monitor threshold: Tier 1: Consumer Lag and Freshness Degradation
scaling_monitoringSignal: Kafka consumer group lag (bytes or offsets) growing for the analytics topic group; ClickHouse dashboard timestamps falling behind wall clock by > 60s; ClickHouse insert throughput < Kafka produce rate
Bottleneck: ClickHouse insert throughput insufficient for Kafka produce rate. Evolution: Tune ClickHouse insert buffer size and async_insert settings; increase consumer parallelism up to the Kafka partition count; batch inserts into ClickHouse using the Buffer engine or materialized views with merge trees
Monitor threshold: Tier 2: Hot Partition and Skewed Consumer Load
scaling_monitoringSignal: One Kafka partition offset growing significantly faster than others; one consumer instance CPU/network saturated while others are idle
Bottleneck: Skewed partition key distribution: high-cardinality entity routing the same high-volume key to one partition. Evolution: Add a secondary hash suffix to the partition key to distribute load; increase topic partition count (note: keyed ordering breaks for existing messages); re-evaluate partition key selection based on actual cardinality measurements
Scaling Pressure Signals
8Kafka consumer group lag (bytes or offsets) growing for the analytics topic group; ClickHouse dashboard timestamps falling behind wall clock by > 60s; ClickHouse insert throughput < Kafka produce rate
Threshold
Tier 1: Consumer Lag and Freshness Degradation
Likely Bottleneck
ClickHouse insert throughput insufficient for Kafka produce rate
Recommended Evolution
Tune ClickHouse insert buffer size and async_insert settings; increase consumer parallelism up to the Kafka partition count; batch inserts into ClickHouse using the Buffer engine or materialized views with merge trees
One Kafka partition offset growing significantly faster than others; one consumer instance CPU/network saturated while others are idle
Threshold
Tier 2: Hot Partition and Skewed Consumer Load
Likely Bottleneck
Skewed partition key distribution: high-cardinality entity routing the same high-volume key to one partition
Recommended Evolution
Add a secondary hash suffix to the partition key to distribute load; increase topic partition count (note: keyed ordering breaks for existing messages); re-evaluate partition key selection based on actual cardinality measurements
ClickHouse system.parts shows parts_to_merge growing; SELECT queries showing slower p99 despite stable data volume; ClickHouse background merge thread CPU saturation
Threshold
Tier 3: ClickHouse Part Merge Backlog
Likely Bottleneck
Insert rate exceeding ClickHouse background merge throughput for the target table
Recommended Evolution
Reduce insert frequency by increasing batch size; tune parts_to_delay_insert and parts_to_throw_insert; consider a Buffer table as an insert intermediary
Business users reporting analytics figures inconsistent with OLTP dashboards; audit requirements necessitating exact match between operational and analytics figures
Threshold
Tier 4: Cross-Store Query Consistency Requirements
Likely Bottleneck
Fundamental eventual consistency gap between OLTP PostgreSQL and analytics store
Recommended Evolution
Introduce event sourcing with snapshot consistency markers to align store states; or accept the eventual consistency model and document the staleness SLA explicitly in analytics tooling
Kafka consumer group lag (bytes or offsets) growing for the analytics topic group; ClickHouse dashboard timestamps falling behind wall clock by > 60s; ClickHouse insert throughput < Kafka produce rate
Threshold
Escalation trigger: ClickHouse insert throughput insufficient for Kafka produce rate
Likely Bottleneck
Tier 1: Consumer Lag and Freshness Degradation
Recommended Evolution
Monitor: queue_depth, consumer_lag_seconds, consumer_throughput
One Kafka partition offset growing significantly faster than others; one consumer instance CPU/network saturated while others are idle
Threshold
Escalation trigger: Skewed partition key distribution: high-cardinality entity routing the same high-volume key to one partition
Likely Bottleneck
Tier 2: Hot Partition and Skewed Consumer Load
Recommended Evolution
Monitor: queue_depth, consumer_lag_seconds, consumer_throughput
ClickHouse system.parts shows parts_to_merge growing; SELECT queries showing slower p99 despite stable data volume; ClickHouse background merge thread CPU saturation
Threshold
Escalation trigger: Insert rate exceeding ClickHouse background merge throughput for the target table
Likely Bottleneck
Tier 3: ClickHouse Part Merge Backlog
Recommended Evolution
Monitor: queue_depth, consumer_lag_seconds, consumer_throughput
Business users reporting analytics figures inconsistent with OLTP dashboards; audit requirements necessitating exact match between operational and analytics figures
Threshold
Escalation trigger: Fundamental eventual consistency gap between OLTP PostgreSQL and analytics store
Likely Bottleneck
Tier 4: Cross-Store Query Consistency Requirements
Recommended Evolution
Monitor: queue_depth, consumer_lag_seconds, consumer_throughput
Migration Readiness
12Migration Stages
3Analytics queries running directly against PostgreSQL OLTP primary → Read replica serving analytics queries via polling ETL
infoMigration trigger: OLTP query p99 degrading during analytics reporting windows; reporting queries showing wait events (LockTimeout, I/O wait) in pg_stat_activity
Polling ETL from read replica to analytics store → WAL CDC → Kafka → ClickHouse streaming ingestion
infoMigration trigger: Sub-minute analytics freshness SLA required; ETL scheduling overhead growing; analytics volume exceeding what the read replica can serve under polling load
ClickHouse with raw event tables only → ClickHouse with materialized views and pre-aggregated summary tables
infoMigration trigger: Dashboard query p95 > 5s on frequently accessed aggregation queries; analyst-driven queries competing with dashboard queries for ClickHouse CPU
Risks
9Read replica replication lag degrades freshness during heavy
warningRead replica replication lag degrades freshness during heavy OLTP write periods
ETL polling creates a minimum latency floor; sub-minute fres
warningETL polling creates a minimum latency floor; sub-minute freshness is not achievable
CDC setup requires PostgreSQL logical replication slot: mand
warningCDC setup requires PostgreSQL logical replication slot: mandatory monitoring obligation from day one
ClickHouse operational model (parts, merges, insert bufferin
warningClickHouse operational model (parts, merges, insert buffering) requires learning investment
Materialized views must be redesigned if source table schema
warningMaterialized views must be redesigned if source table schema changes
Stale materialized views (if refresh fails silently) mislead
warningStale materialized views (if refresh fails silently) mislead downstream consumers
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
Consumer lag silently accumulates: a lagging consumer is not
criticalConsumer lag silently accumulates: a lagging consumer is not a failed consumer. Mitigation: Alert on consumer lag rate-of-change, not absolute depth; implement dead letter queues with alerting
↗ modular-monolith-to-event-driven
Missing partition for current time window causes all INSERTs
criticalMissing partition for current time window causes all INSERTs to fail with 'no partition of relation found'. Mitigation: Create partitions 7-30 days in advance; alert when next partition does not exist before its time window opens
↗ postgresql-to-partitioned
Review Sections
6Referenced Intelligence