Reqflow
← All comparisons

Typeahead / Autocomplete vs URL Shortener

Typeahead / Autocomplete

Typeahead / Autocomplete

Trie-based prefix matching, trie caching, ranking by frequency, query collection pipeline.

Components (7)

  • Client
  • API Gateway
  • Suggestion Service
  • Redis Trie Cache
  • Query Log (Kafka)
  • Aggregation Pipeline
  • Query Frequency DB

Headline numbers

  • Suggestion QPS~87,000 req/sec
  • Redis memory for trie cache~50 GB
  • Query log throughput~29,000 events/sec
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 Typeahead / Autocomplete
  • Query Log (Kafka)
In both
  • Client
  • Api Gateway
  • Service
  • Cache
  • Database
Only in URL Shortener
None.

Flow shape

Typeahead / Autocomplete flows
  • User types a prefix4 steps
  • Aggregation pipeline updates suggestions3 steps
  • Cache miss on rare prefix4 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