System Design Interview

Understand the Problem

Scope 2 min readLesson 2 of 5

Step 1 – Understand the problem and establish design scope

The following questions help to clarify the requirements and narrow down the scope.

Clarifying the scope
Candidate

Which features should be included in the design?

Interviewer

We would like you to design an S3-like object storage system with the following functionalities:

  • Bucket creation.

  • Object uploading and downloading.

  • Object versioning.

  • Listing objects in a bucket. It’s similar to the “aws s3 ls” command 8.

Candidate

What is the typical data size?

Interviewer

We need to store both massive objects (a few GBs or more) and a large number of small objects (tens of KBs,) efficiently.

Candidate

How much data do we need to store in one year?

Interviewer

100 petabytes (PB).

Candidate

Can we assume data durability is 6 nines (99.9999%) and service availability is 4 nines (99.99%)?

Interviewer

Yes, that sounds reasonable.

Non-functional requirements

  • 100 PB of data

  • Data durability is 6 nines

  • Service availability is 4 nines

  • Storage efficiency. Reduce storage costs while maintaining a high degree of reliability and performance.

Back-of-the-envelope estimation

Object storage is likely to have bottlenecks in either disk capacity or disk IO per second (IOPS). Let’s take a look.

  • Disk capacity. Let’s assume objects follow the distribution listed below:

    • 20% of all objects are small objects (less than 1MB).

    • 60% of objects are medium-sized objects (1MB ~ 64MB).

    • 20% are large objects (larger than 64MB).

  • IOPS. Let’s assume one hard disk (SATA interface, 7200 rpm) is capable of doing 100~150 random seeks per second (100-150 IOPS).

With those assumptions, we can estimate the total number of objects the system can persist. To simplify the calculation, let’s use the median size for each object type (0.5MB for small objects, 32MB for medium objects, and 200MB for large objects). A 40% storage usage ratio gives us:

  • 100 PB = 100*1000*1000*1000 MB = 101110^{11} MB

  • 101110^{11}*0.4/( 0.2*0.5MB + 0.6 *32MB + 0.2*200MB) = 0.68 billion objects.

  • If we assume the metadata of an object is about 1KB in size, we need 0.68 TB space to store all metadata information.

Even though we may not use those numbers, it’s good to have a general idea about the scale and constraint of the system.

Finished reading?

Mark it complete to track your progress.