🎉 75% of content is free forever — Unlock Premium from $10/mo →
CW
đŸ’ŧ Servicesâ„šī¸ Aboutâœ‰ī¸ ContactView Pricing Plansfrom $10

Design Google Drive

System Design ProblemsFile Sync & StorageđŸŸĸ Free Lesson

Advertisement

System Design Problems

Design Google Drive

Google Drive enables users to store files in the cloud, sync across devices, and share with collaborators. The system must handle file uploads (up to 5 TB), real-time sync, conflict resolution when multiple users edit simultaneously, and efficient delta sync for large files.

  • File Sync — Changes propagate across devices within seconds
  • Conflict Resolution — Handle concurrent edits gracefully
  • Sharing — Granular permissions (view, comment, edit) per file/folder

The fundamental challenge is synchronization: when two users edit the same file simultaneously, the system must resolve conflicts without losing data.

Requirements

Functional Requirements

  • Upload and download files (up to 5 TB)
  • Real-time sync across multiple devices
  • File versioning and history
  • Conflict resolution for concurrent edits
  • Sharing with permissions (view, comment, edit)
  • Folder hierarchy and organization
  • Offline editing with sync on reconnect

Non-Functional Requirements

  • Latency: Sync changes within 5 seconds
  • Durability: 99.999999999% (11 nines)
  • Availability: 99.99%
  • Scale: 1 billion files, 500M active users
  • Bandwidth: Efficient delta sync for large files

Back-of-the-Envelope Estimation

High-Level Architecture

DesktopClientMobileClientWebClientAPI GatewayDrive ServiceFile ManagerSync EngineDelta CalculatorConflict ResolverVersion ManagerSharing ServiceNotificationMetadata DB(PostgreSQL)Block Storage(S3/GCS)Notification(WebSocket)Google Drive Architecture

Detailed Design

File Chunking and Block Storage

Delta Sync

ClientBlock 1 ✓Block 2 ✗ NEWBlock 3 ✓Upload OnlyChanged Blocks(256 KB)ServerDelta sync: upload only changed blocks

Conflict Resolution

For binary files (PDF, images):

  1. User A edits file offline
  2. User B edits file online
  3. User A reconnects and syncs
  4. System detects conflict (version mismatch)
  5. Creates "conflict copy" for User A
  6. User B's version becomes the current version
  7. User manually merges if needed

File Versioning

Architecture Diagram
File versions:
v1: block_1, block_2, block_3 (created 2026-06-18)
v2: block_1, block_4, block_3 (created 2026-06-19, block_2 changed to block_4)
v3: block_5, block_4, block_3 (created 2026-06-20, block_1 changed to block_5)

Sharing and Permissions

Architecture Diagram
File ACL:
{
  "file_id": "file_123",
  "owner": "user_a@example.com",
  "permissions": [
    { "user": "user_b@example.com", "role": "editor" },
    { "user": "user_c@example.com", "role": "viewer" },
    { "group": "team@example.com", "role": "commenter" }
  ]
}

Practice Exercises

  1. Design: How would you implement real-time collaborative editing for Google Docs (not just binary files)? Design the Operational Transformation system.

  2. Scale: If 500M users each have 10 GB of files with a deduplication ratio of 3x, estimate the total storage and the block storage architecture.

  3. Sync: Design a delta sync algorithm that efficiently computes the diff between two versions of a 10 GB video file.

  4. Offline: How would you handle offline editing where the user edits a file on two devices without internet? Design the conflict detection and resolution strategy.


What to Learn Next

-> Design Google Docs Real-time collaborative editing with OT/CRDT.

-> Design Object Storage Block storage and deduplication at scale.

-> Data Replication Replicating file data across data centers.

-> Design Chat System Real-time sync with WebSocket and conflict resolution.

-> Caching Strategies Caching frequently accessed files at the edge.

-> Security Patterns File encryption and access control.

Need Expert System Design Help?

Get personalized tutoring, project support, or professional consulting.

Advertisement