Skip to article frontmatterSkip to article content
Site not loading correctly?

This may be due to an incorrect BASE_URL configuration. See the MyST Documentation for reference.

System Design

Design Factors

Common Design Principles

Examples

Dropbox

Design Factors

Design

Client-side components:

Server-side components:

Database design:

File transfers and retries would be chunked, for low latency and high reliability. Need “chunker” and “de-chunker” components (client-side only?).

The file transfer pattern is a star pattern, with client devices syncing with the central file server and metadata database, rather than also being able to sync with each other. This allows for high data consistency.

File change events allow devices (both client- and server-side file storage) to download only changes, not entire files, allowing for low latency. A component may be needed (server-side only?) to diff newly uploaded file versions into change events. Per-device queues of file change events allow devices (including the file server) to quickly get up-to-date after being offline for a bit, allowing for high availability. For data accuracy and due to the fact that changes may build on each other, individual events cannot expire. The queue for a client device is deleted if it has been inactive for too long or completely emptied if there are too many enqueued events. There are two reasons for this. Firstly, to save server space. Secondly, if the client device comes back online, it may have to process a lot of change events for the same file, which may be slower than just downloading the latest version, hence deleting the queue. The queue management service would create queues for newly registered devices and delete the queues of inactive devices.

The synchronization service would handle merge conflicts due to divergent changesets by creating file copies (“current” version and “incoming” version).

The file server may store files in chunks.

Twitter

Design Factors

Each tweet is small (limited number of characters) but there are billions of them.

Design

Client-side components:

Server-side components:

Database design:

New tweets are sent to tweet event queues, SQL database, search service, and possibly trends service.

Tweet events are queued for pushing to followers via websocket, as long as they do not have too many followers (e.g., celerities).

The search service uses an inverted full text index in which significant words are tokenized and each word/token is mapped to tweets that contain it. Search results are sorted in descending order of popularity and number of words matching the query.

The trends service computes and stores trending hashtags or topics. It maintains a tweet/view count per hashtag/topic, per location. Options:

Netflix

Design Factors

Design

Client-side components:

Server-side components:

Database design:

Video management service:

Event Ticketing System

Unsold tickets must be locked while a user is looking at buying them, until payment has been processed, otherwise there would be a risk that a user buys a ticket while another user is looking at them (or that a ticket is accidentally sold to two users).

Search Auto-Complete

TinyURL

Such a service would shorten URLs entered by a user by storing the original URLs in a lookup table with the short URLs. When the short link is accessed by someone, the website would redirect them to the original link. This represents two main components:

For such a service, eventual consistency is acceptable, and high availability and low latency is vital, suggesting a NoSQL database. It should have a BTree index on the short URL.

The service might also have the following features:

An EV Charging System

Front-end components:

Server-side components:

Flows: