Crushing Tech Education

Crushing Tech Education

Share this post

Crushing Tech Education
Crushing Tech Education
Design Dropbox | Client | Server | Data Sync
Copy link
Facebook
Email
Notes
More
User's avatar
Discover more from Crushing Tech Education
Join a community of engineers and technical managers dedicated to learning System Design.
Over 3,000 subscribers
Already have an account? Sign in
System Design

Design Dropbox | Client | Server | Data Sync

How to design Dropbox. Client and Server components with data sync

Sep 30, 2023

Share this post

Crushing Tech Education
Crushing Tech Education
Design Dropbox | Client | Server | Data Sync
Copy link
Facebook
Email
Notes
More
Share

Designing a Dropbox-like system involves creating a distributed file storage and synchronization platform that allows users to store, access, and sync their files across various devices and locations. Below are some key responsibilities of the client:

  1. Monitoring the workspace for any changes.

  2. Uploading or downloading file changes to/from the remote server.

  3. Handling conflicts that may arise due to offline usage or concurrent updates.

  4. Updating file metadata on the remote server when changes occur.

Consider a 1 GB file with three consecutive minor changes. In this scenario, the entire 1 GB file is sent to the remote server three times and subsequently downloaded three times by another client. This process consumes a total of 3 GB of upload bandwidth and 3 GB of download bandwidth. Furthermore, the download bandwidth usage increases in proportion to the number of clients monitoring the file.

Crushing Tech Education is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.

A total of 6 GB of bandwidth was utilized for just a few minor changes! Additionally, in case of a loss of connectivity, the client must re-upload/download the entire file. This represents a significant waste of bandwidth, prompting us to explore optimization possibilities.

Now, let's consider a different approach where we develop a client that breaks files into smaller 4 MB chunks and uploads them to the remote server. This approach, known as the 'Smart Dropbox Client,' significantly reduces bandwidth usage:

If a file is modified, the client identifies which specific chunk has changed and only uploads that chunk to the remote server. On the receiving end, the other client is notified of the changed chunk and downloads only that portion. This efficient process consumes just 24 MB of bandwidth for synchronizing three minor changes to the file, as opposed to the previous 6 GB.

With this optimization in mind, let's delve into the various components of this optimized client:

  1. Client Metadata Database: This database stores information about different files in the workspace, file chunks, chunk versions, and file locations in the file system. It can be implemented using a lightweight database like SQLite.

  2. Chunker: The Chunker divides large files into 4 MB chunks and can also reconstruct the original file from these chunks.

  3. Watcher: The Watcher monitors workspace for file changes such as updates, creations, and deletions, notifying the Indexer of any changes.

  4. Indexer: The Indexer listens for events from the Watcher and updates the Client Metadata Database with information about modified file chunks. It also informs the Synchronizer after committing changes to the database.

  5. Meta Service: The Meta Service is responsible for synchronizing file metadata from clients to the server. It determines the change set for different clients and broadcasts it to them using the Notification Service. The database behind the Meta Service should provide strong ACID properties, making relational databases like MySQL or PostgreSQL suitable choices. An in-memory cache can be employed to optimize performance, using Redis or Memcached.

  6. Block Storage Service: The Block Storage Service interacts with block storage for uploading and downloading file chunks. It notifies the Meta Service when a client finishes downloading a file and updates metadata. Block Storage can be implemented using distributed file systems such as Amazon S3, ensuring high reliability and durability.

  7. Notification Service: The Notification Service broadcasts file changes to connected clients to ensure all watching clients receive immediate updates. It can be implemented using HTTP Long Polling, Websockets, or Server Sent Events. Before sending data to clients, the Notification Service reads messages from a message queue, which can be implemented using Kafka. This decoupling allows both the Meta Service and Notification Service to scale independently without affecting performance."

Here's a more detailed explanation 👇‍

Crushing Tech Education is a reader-supported publication. To receive new posts and support my work, consider becoming a free or paid subscriber.

Share this post

Crushing Tech Education
Crushing Tech Education
Design Dropbox | Client | Server | Data Sync
Copy link
Facebook
Email
Notes
More
Share

Discussion about this post

User's avatar
Starting an Architecture Review Team
How to start, manage, and deliver!
Feb 25, 2024 • 
SWE
 and 
Fran Soto
13

Share this post

Crushing Tech Education
Crushing Tech Education
Starting an Architecture Review Team
Copy link
Facebook
Email
Notes
More
3
Design a Coding Contest Platform like Leetcode
Remote code execution engine and database design.
Feb 3, 2024 • 
SWE
12

Share this post

Crushing Tech Education
Crushing Tech Education
Design a Coding Contest Platform like Leetcode
Copy link
Facebook
Email
Notes
More
6
Design Stock Exchange | HLD | Data Model | Reliability
Design a stock exchange, process buy and sell orders efficiently in memory
Jan 6, 2024
2

Share this post

Crushing Tech Education
Crushing Tech Education
Design Stock Exchange | HLD | Data Model | Reliability
Copy link
Facebook
Email
Notes
More

Ready for more?

© 2025 Crushing Tech Education
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More

Create your profile

User's avatar

Only paid subscribers can comment on this post

Already a paid subscriber? Sign in

Check your email

For your security, we need to re-authenticate you.

Click the link we sent to , or click here to sign in.