PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/Amazon

Design document-tag classes with concurrency safety

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to design in-memory class interfaces and indices for a document–tag manager, specify duplicate handling and normalization policies, and extend the design with concurrency control while reasoning about time and space complexity.

  • hard
  • Amazon
  • System Design
  • Software Engineer

Design document-tag classes with concurrency safety

Company: Amazon

Role: Software Engineer

Category: System Design

Difficulty: hard

Interview Round: Onsite

Design classes to manage documents and tags. Support operations: create/delete document; create/delete tag; add/remove a tag on a document; list all documents for a given tag; list all tags for a given document; and query documents by the intersection of multiple tags. Specify class interfaces, core data structures and indices, handling of duplicates/normalization (e.g., case sensitivity), and complexity of key operations. Then extend the design to be thread-safe under concurrent reads/writes: discuss concurrency control (locking granularity, immutable data, copy-on-write, or concurrent maps), consistency guarantees, deadlock avoidance, and approaches to testing concurrency correctness.

Quick Answer: This question evaluates a candidate's ability to design in-memory class interfaces and indices for a document–tag manager, specify duplicate handling and normalization policies, and extend the design with concurrency control while reasoning about time and space complexity.

Related Interview Questions

  • Design a Log Collection System - Amazon (medium)
  • Design Human Avoidance for Warehouse Robots - Amazon (medium)
  • Design a High-Availability Load Balancer - Amazon (hard)
  • Design a Ride-Hailing Matching System - Amazon (medium)
  • Design a cloud database write path and recovery - Amazon (hard)
Amazon logo
Amazon
Jul 31, 2025, 12:00 AM
Software Engineer
Onsite
System Design
3
0

System Design: In‑Memory Document–Tag Manager (Single Node)

Context

You are designing an in-memory component that manages documents and tags. The component should expose a clear class interface, maintain efficient indices, and provide well-defined behavior regarding duplicates and normalization (e.g., case sensitivity). Later, extend the design to support safe concurrent reads and writes.

Assume documents and tags are small (e.g., IDs/strings and lightweight metadata), and the system runs on a single node process. Persistence, sharding, and distributed coordination are out of scope.

Requirements

  1. Core operations
    • Create/Delete document
    • Create/Delete tag
    • Add/Remove a tag on a document
    • List all documents for a given tag
    • List all tags for a given document
    • Query documents by intersection of multiple tags (logical AND)
  2. Deliverables
    • Class interfaces (public API) and core internal data structures/indices
    • Duplicate handling and normalization policy (e.g., case sensitivity for tags)
    • Time and space complexity of key operations
  3. Concurrency extension (same API, multi-threaded use)
    • Concurrency control strategy (locking granularity, immutable/COW structures, or concurrent maps)
    • Consistency guarantees for readers/writers
    • Deadlock avoidance strategy
    • Approaches to testing concurrency correctness

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Amazon•More Software Engineer•Amazon Software Engineer•Amazon System Design•Software Engineer System Design
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.