Skip to content

Ingestion Pattern Comparison Matrix

Visual comparison of all evaluated event ingestion patterns for the bxb usage-based billing platform.

IDPatternData Flow
P1PostgreSQL OnlyAPI → PostgreSQL
P2PostgreSQL + ETLAPI → PostgreSQL → ETL → ClickHouse
P3Kafka + ClickHouseAPI → Kafka → Batch Consumer → ClickHouse
P4ClickHouse DirectAPI → ClickHouse
P5Kafka + FlinkAPI → Kafka → Flink → ClickHouse
DimensionP1: PG OnlyP2: PG + ETLP3: Kafka + CHP4: CH DirectP5: Kafka + Flink
Max Throughput5-10k/sec5-10k/sec50-100k/sec100-500k/sec100k-1M/sec
Ingestion Latency<10ms5-60 min1-2 min<100ms<1 sec
Query Latency (100M rows)2-30 sec10-500ms10-500ms10-500ms10-500ms
Throughput Rating:small_orange_diamond::small_orange_diamond::white_check_mark::white_check_mark::white_check_mark:
DimensionP1: PG OnlyP2: PG + ETLP3: Kafka + CHP4: CH DirectP5: Kafka + Flink
Event ReplayNoNoYes (7 days)NoYes (7 days)
Data Loss RiskVery LowLowVery LowMediumVery Low
ACID TransactionsYesYes (PG side)No (eventual)NoNo
DeduplicationBuilt-inBuilt-inEventual (merge)Eventual (merge)Exactly-once
Durability Rating:white_check_mark::white_check_mark::white_check_mark::small_orange_diamond::white_check_mark:
DimensionP1: PG OnlyP2: PG + ETLP3: Kafka + CHP4: CH DirectP5: Kafka + Flink
Infra Cost (10k/sec)~$350/mo~$800/mo~$1,000/mo~$350/mo~$1,710/mo
Infra Cost (50k/sec)N/AN/A~$2,000/mo~$700/mo~$3,200/mo
Infra Cost (100k/sec)N/AN/A~$3,300/mo~$1,400/mo~$5,300/mo
Component Count24-5426-7
Team Expertise NeededSQLSQL + ETLSQL + KafkaSQL + CHSQL + Kafka + JVM
Cost Rating:white_check_mark::small_orange_diamond::small_orange_diamond::white_check_mark::red_circle:
DimensionP1: PG OnlyP2: PG + ETLP3: Kafka + CHP4: CH DirectP5: Kafka + Flink
Horizontal ScaleLimitedLimitedEasyEasyEasy
Add ProcessorsDifficultModerateEasyDifficultEasy
Multi-ConsumerNoNoYesNoYes
Backpressure HandlingDB locksDB locksKafka bufferingManualKafka buffering
Scalability Rating:red_circle::red_circle::white_check_mark::small_orange_diamond::white_check_mark:

Rating scale: 3 = Excellent, 2 = Acceptable, 1 = Poor

Criterion (Weight)P1P2P3P4P5
Throughput (25%)11333
Replay Capability (20%)11313
Cost Efficiency (20%)32231
Operational Simplicity (15%)31231
Scalability (10%)11323
Query Performance (10%)13333
Weighted Score1.601.302.652.352.20
  1. P3: Kafka + ClickHouse — 2.65 (Chosen)
  2. P4: ClickHouse Direct — 2.35
  3. P5: Kafka + Flink — 2.20
  4. P1: PostgreSQL Only — 1.60
  5. P2: PostgreSQL + ETL — 1.30

P3 (Kafka + ClickHouse) was selected because:

  • Replay is non-negotiable — every event affects revenue; ability to reprocess after bug fixes is critical (eliminates P1, P2, P4)
  • Cost-effective at 10k/sec — $1,000/mo vs P5’s $1,710/mo, with no JVM overhead for simple write-through
  • Clear scaling path — grows from 10k to 100k/sec by adding partitions, consumers, and ClickHouse nodes
  • Python-native — batch consumer is simple Python; no Flink/JVM expertise required
  • Proven fallback — PostgreSQL remains source of truth; queries fall back during ClickHouse downtime
TriggerConsider
Sustained throughput > 80k/sec with complex enrichmentMigrate to P5 (add Flink)
Analytics-only workload, no billingSimplify to P4 (ClickHouse direct)
Event volume < 1k/sec, cost-constrained startupStart with P1 (PostgreSQL only)
Real-time fraud detection neededAdd Kafka Streams alongside P3