Design Attachment Storage With Content Deduplication for Gmail

Last updated: November 29, 2026

Quick Overview

Design how Gmail stores email attachments so that the same file sent to thousands of recipients is stored once, while deletion, privacy, and per-user storage accounting still work correctly.

Google
System Design
Software Engineer
Google
November 29, 2026
Software Engineer
System Design Round
System Design
Medium

0

0

0 solved


Design how Gmail stores email attachments so that the same file sent to thousands of recipients is stored once, while deletion, privacy, and per-user storage accounting still work correctly.

A Google onsite storage question with a privacy angle. The interviewer checks content addressing, reference counting and garbage collection at scale, and the subtle risks of cross-user deduplication.

What the Interviewer Expects
  • Store attachments as content-addressed blobs keyed by a strong hash
  • Track references safely and garbage collect unreferenced blobs
  • Decide on dedupe scope and explain cross-user privacy risks
  • Keep per-user quota accounting independent of physical dedupe
  • Handle large attachments with chunking
Key Topics to Cover
content addressing
reference counting
garbage collection
dedupe privacy
chunking
How to Approach This
  1. Start by clarifying functional and non-functional requirements with the interviewer.
  2. Estimate the scale: QPS, storage, bandwidth. This drives your design decisions.
  3. Draw a high-level architecture first, then deep dive into 1-2 critical components.
  4. Discuss trade-offs explicitly (e.g., consistency vs availability, SQL vs NoSQL).
  5. Address failure scenarios, monitoring, and how the system handles 10x traffic spikes.
Possible Follow-up Questions
  • Can an attacker learn whether someone else has a file by uploading it and watching timing?
  • How do you delete a blob when the last reference goes away without race conditions?
  • Should quota charge each recipient the full size even though it is stored once?
  • How does per-user encryption interact with dedupe?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements
  • Attachments up to 25 MB per email (larger files go via Drive links).
  • A newsletter or company-wide email may deliver the same attachment to millions of mailboxes.
  • Users delete messages; storage m...
High-Level Design
  • On receipt, the MIME parser extracts attachments, computes SHA-256, and stores the blob in a blob store keyed by hash (if not already present).
  • The message record stores `attachment_ref(hash, ...

Submit Your Answer
Markdown supported