← All comparisons

Apache Kafka vs URL Shortener

Apache Kafka

Apache Kafka

Partitioned, replicated, append-only log. Producers, brokers, consumer groups, leader/follower replication.

Components (8)

  • Producer
  • Broker 1
  • Broker 2
  • Broker 3
  • Coordination Service
  • Consumer A1
  • Consumer A2
  • Consumer B1

Headline numbers

  • Cluster ingest~2.4 GB/sec
  • Cluster storage~1.5 PB
  • Max consumer parallelism per group100
URL Shortener

URL Shortener

Hashing, key generation, read-heavy caching.

Components (6)

  • Client
  • API Gateway
  • Write Service
  • Read Service
  • Redis
  • Postgres

Headline numbers

  • Write QPS (avg)~1,200/sec
  • Read QPS (avg)~120,000/sec
  • Storage per year~5 TB

Key differences

Only in Apache Kafka
None.
In both
  • Service
Only in URL Shortener
  • Client
  • API Gateway
  • Redis
  • Postgres

Flow shape

Apache Kafka flows
  • Produce a message (acks=all)3 steps
  • Group A consumes both partitions in parallel3 steps
  • Group B reads independently of Group A2 steps
  • New consumer joins: group rebalance4 steps
  • Partition leader fails (failover)4 steps
  • Slow consumer triggers rebalance4 steps
URL Shortener flows
  • Shorten a URL3 steps
  • Resolve short URL (cache hit)3 steps
  • Resolve short URL (cache miss)4 steps
  • Redis is down4 steps