Technical Interview Questions

QQ Message Storage and Retrieval at Scale

"QQ has over 500 million monthly active users generating massive chat histories. How would you design the message storage and retrieval system to support fast search and multi-device synchronization?"

Why Interviewers Ask This

QQ is one of Tencent's foundational products and still handles enormous message volumes. This question evaluates your ability to design storage systems that balance write throughput, read performance, and cross-device consistency.

How to Answer

  1. 1

    Define the data model: messages indexed by conversation ID and sequence number, with metadata like timestamp, sender, type, and content.

  2. 2

    Describe a hot-cold tiered storage strategy: recent messages in a distributed cache (Redis clusters), older messages in a distributed KV store, and very old messages in cold storage (object storage + index).

  3. 3

    Explain multi-device sync using a pull model with server-side cursors: each device tracks its last-synced sequence ID per conversation.

  4. 4

    Discuss search implementation: inverted index for keyword search, built on top of the message store with async indexing to avoid write path latency.

Sample Answer

I would design a tiered storage system. The data model centers on a message table keyed by (conversation_id, sequence_id), storing sender, timestamp, content type, and body. Hot data (last 7 days) lives in Redis clusters sharded by conversation ID, providing sub-millisecond reads for active chats. Warm data (7 days to 6 months) moves to a distributed LSM-based KV store like RocksDB clusters, optimized for sequential reads when users scroll through history. Cold data beyond 6 months is archived to object storage with a sparse index for on-demand retrieval. For multi-device sync, each device maintains a per-conversation cursor (last seen sequence ID). When a device comes online, it pulls all messages after its cursor — the server streams them in batches. Message search uses an asynchronous inverted index pipeline: new messages are indexed via a Kafka consumer into an Elasticsearch cluster, supporting keyword and sender-based queries with conversation-scoped filtering.

Pro Tips

  • Emphasize the tiered storage approach — interviewers want to see you think about cost optimization, not just raw performance.

  • Mention the trade-off between storage cost and retrieval latency for cold data explicitly.

  • Discuss how to handle media messages (images, files) separately from text in the storage architecture.

Frequently Asked Questions

How do you handle message deletion across multiple devices?

Deletions are recorded as tombstone operations with their own sequence IDs. When a device syncs, it receives the tombstone and removes the message locally. Tombstones are retained for a configurable period (e.g., 30 days) to ensure all devices process them.

How would you handle the search index falling behind the message store?

The search pipeline includes a lag monitor. If indexing lag exceeds a threshold, the system temporarily increases consumer parallelism. Users see a disclaimer for very recent messages that may not yet be searchable. Critical messages (like those containing URLs) get priority indexing.

Worried About Going Blank in Your Interview?

HireMe AI listens to your interview in real-time, detects questions, and generates instant answer suggestions — so you never freeze up again.

Try HireMe AI Free