Design a Top-K search words service

Read the full interview experience this question came from →

Quick Overview

The question evaluates understanding of scalable, low-latency analytics and search-event systems, including high-throughput event ingestion, Top-K aggregation across all-time and sliding windows, normalization/deduplication trade-offs, and multi-region consistency considerations.

Design a Top-K search words service

Company: LinkedIn

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

## Scenario Design a service that tracks user search queries and returns the **Top-K most searched words/queries**. ## Requirements ### Functional - API to **record** a search query event (e.g., user searches "iphone 16"). - API to fetch **Top-K** queries. - Support a time window variant: - (a) all-time Top-K - (b) Top-K over the last **N minutes/hours** (trending) ### Non-functional - High write QPS (search events), low latency reads for Top-K. - Scalable horizontally. - Reasonable correctness (define whether exact or approximate is acceptable). ## Clarifications to address - What is a “word” vs “query” (full string)? - Case-folding, normalization, stop words, punctuation. - Deduping (e.g., multiple searches by same user) or count every event. - Multi-region and eventual consistency expectations.

Overview: The question evaluates understanding of scalable, low-latency analytics and search-event systems, including high-throughput event ingestion, Top-K aggregation across all-time and sliding windows, normalization/deduplication trade-offs, and multi-region consistency considerations.

Read the full LinkedIn Software Engineer interview experience this question came from

|Home/System Design/LinkedIn
LinkedIn logo
LinkedIn
Oct 20, 2025
mediumSoftware EngineerTechnical ScreenSystem Design
27
0

Scenario

Design a service that tracks user search queries and returns the Top-K most searched words/queries.

Requirements

Functional

  • API to record a search query event (e.g., user searches "iphone 16").
  • API to fetch Top-K queries.
  • Support a time window variant:
    • (a) all-time Top-K
    • (b) Top-K over the last N minutes/hours (trending)

Non-functional

  • High write QPS (search events), low latency reads for Top-K.
  • Scalable horizontally.
  • Reasonable correctness (define whether exact or approximate is acceptable).

Clarifications to address

  • What is a “word” vs “query” (full string)?
  • Case-folding, normalization, stop words, punctuation.
  • Deduping (e.g., multiple searches by same user) or count every event.
  • Multi-region and eventual consistency expectations.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...