Design a scalable tagging system
Company: Atlassian
Role: Software Engineer
Category: System Design
Difficulty: hard
Interview Round: Technical Screen
##### Question
Design a scalable tagging system that lets users attach multiple tags to arbitrary resources (items) and query them efficiently. The system must support creating and managing tags, attaching/removing tags, and high read/write traffic. Address the following:
1. **Tag lifecycle:** Create / get-or-create tags, attach and remove tags from items, and prevent duplicate (item, tag) assignments.
2. **Single-tag query:** Return all items for a given tag, with pagination and sorting (e.g., by recency).
3. **Multi-tag query (AND / OR):** Return items matching a combination of tags, supporting both intersection (AND) and union (OR).
4. **Top-N per tag:** Efficiently list the top-N items for a tag (e.g., by recency or score).
5. **Counts:** Return the number of items per tag.
6. **Autocomplete / suggestions:** Prefix-based tag autocomplete and (optionally) related-tag suggestions.
7. **Data model & storage:** Specify the data model and storage choices for tags, items, and assignments.
8. **Indexing:** Indexing strategy for fast writes and reads, including an inverted index (tag → items) and forward index (item → tags), plus secondary indexes to handle high-cardinality / skewed tags.
9. **Caching:** What to cache, cache-invalidation strategy, and hot-key handling.
10. **Sharding / partitioning:** How to partition the OLTP store and the index, including multi-tenancy isolation and hot-tag mitigation.
11. **Consistency:** Choose and justify a consistency model (eventual vs. strong) and explain how to support read-your-writes.
12. **De-duplication, rename, and merge:** How tag de-duplication, renaming, and merging two tags are handled.
13. **Access control:** Tenant isolation and per-resource ACL filtering.
14. **Pagination:** A stable, scalable pagination strategy.
15. **Backfill & cleanup:** Reindex/backfill jobs and cleanup of orphan tags and drifted counters.
16. **Capacity, monitoring, and SLAs:** Provide order-of-magnitude capacity estimates and describe the key metrics, alerts, and SLOs.
Quick Answer: This question tests a candidate's ability to design scalable data models and distributed indexing strategies for a multi-tenant tagging system. It evaluates system design competency across storage, caching, sharding, and consistency trade-offs — core skills assessed in senior software engineering interviews.