Bird
Raised Fist0

Block Storage vs Object Storage vs File Storage - When to Use Which

HLDmediumInterview freq: medium
Choose your preparation mode4 modes available
🏗️
Block Storage vs Object Storage vs File Storage - When to Use Which
Design decision framework for choosing block, object, or file storage based on workload and scale
mediumStorage SystemsFreq: medium
⚙️
Functional Requirements
  • Store and retrieve data with different access patterns: random block-level, large object, and hierarchical file access
  • Support metadata management for objects and files (e.g., tags, permissions)
  • Provide APIs for block device access, object REST APIs, and file system protocols (NFS/SMB)
  • Enable scalability to billions of objects or petabytes of data
  • Support data durability and replication policies
  • Allow integration with compute instances and applications requiring different storage types
📊
Non-Functional Requirements
  • Availability SLA of 99.99% or higher for all storage types
  • Latency targets: block storage <5ms P99, object storage <100ms P99, file storage <10ms P99
  • Throughput: support up to 925K write ops/sec for block storage, 1M object PUTs/sec, and 500K file ops/sec
  • Durability: 11 9's (99.999999999%) for object storage, 6 9's for block and file storage
  • Scalability to 2 billion daily active users generating 40 storage ops/user/day
❓
Clarifying Questions to Ask
  • What are the primary workloads and access patterns expected for each storage type?
  • What is the expected data size distribution (small blocks vs large objects vs files)?
  • Are there specific latency or throughput SLAs per storage type?
  • What consistency guarantees are required (strong, eventual)?
  • Is multi-tenancy or namespace isolation required?
  • What is the expected retention period and data lifecycle management?
Out of Scope
✗ Designing the underlying physical storage hardware (e.g., SSDs, HDDs)
✗ Network infrastructure design beyond storage access protocols
✗ Security mechanisms like encryption key management
✗ Backup and disaster recovery processes
📌
Assumptions
  • 2 billion daily active users (DAU)
  • Each user generates 40 storage operations per day (writes or reads)
  • Average object size is 100 KB for object storage
  • Block storage writes are 4 KB per operation
⚡
QPS Calculation
write qps2B × 40 / 86400 ≈ 925,926 writes/sec
peak write qpsAssuming 3× peak factor: 925,926 × 3 ≈ 2.78M writes/sec
read qpsAssuming read:write ratio 3:1, read_qps = 3 × 925,926 ≈ 2.78M reads/sec
💾
Storage Estimate
daily storage object925,926 writes/sec × 100 KB × 86400 sec ≈ 8 PB/day
daily storage block925,926 writes/sec × 4 KB × 86400 sec ≈ 320 TB/day
retention days30
total storage object8 PB × 30 = 240 PB
total storage block320 TB × 30 = 9.6 PB
with replication 3x[object Object]
🖥️
Server Estimate
object storage nodesAssuming 1 PB/node capacity, need 720 nodes for replication
block storage nodesAssuming 100 TB/node capacity, need 288 nodes for replication
🏗️
Architecture Diagram
Architecture Diagram
          +----------------+
          |   Client App   |
          +-------+--------+
                  |
    +-------------+--------------+
    |                            |
+---v---+                  +-----v-----+
| Block |                  | Object    |
|Storage|                  | Storage   |
+---+---+                  +-----+-----+
    |                            |
    |                            |
+---v---+                  +-----v-----+
| SAN/NVMe|                | Distributed|
| Storage |                | Object DB  |
+---------+                +-----------+
                              |
                        +-----v-----+
                        | Metadata  |
                        | Service   |
                        +-----------+
                              |
                        +-----v-----+
                        | File      |
                        | Storage   |
                        +-----------+
🧩
Components
Block Storage
Provides low-latency, random read/write access to fixed-size blocks for VM disks and databases
Why thisNVMe over Fabrics offers sub-5ms latency and high IOPS needed for transactional workloads
Why notObject storage like Amazon S3 has higher latency and lacks block-level mutability
Object Storage
Stores large amounts of unstructured data as immutable objects with metadata and REST APIs
Why thisAmazon S3-compatible systems scale to exabytes with 11 9's durability and eventual consistency
Why notBlock storage cannot scale to billions of objects and lacks rich metadata support
File Storage
Provides hierarchical namespace and POSIX semantics for shared file access via NFS/SMB
Why thisDistributed file systems like Lustre or Amazon EFS support concurrent access with strong consistency
Why notObject storage lacks POSIX semantics; block storage is not shared across clients easily
Metadata Service
Manages namespace, permissions, and metadata for files and objects
Why thisCassandra offers scalable, highly available metadata storage with tunable consistency
Why notRelational DBs like PostgreSQL do not scale linearly to billions of metadata entries
SAN/NVMe Storage Backend
Physical storage layer providing persistent block devices with redundancy
Why thisEnterprise SANs with RAID and NVMe SSDs deliver required durability and performance
Why notDirect-attached storage lacks scalability and fault tolerance at this scale
🔄
Data Flow
1
Client App → Metadata Service
Lookup namespace and permissions for requested file or object
Ensures access control and resolves storage location
2
Client App → Block Storage
Send block-level read/write requests for VM disks or databases
Low-latency path for transactional workloads
3
Client App → Object Storage
PUT/GET objects via REST API with metadata
Handles large unstructured data with eventual consistency
4
Client App → File Storage
Access files via NFS/SMB protocols
Supports shared access with POSIX semantics
5
Block Storage → SAN/NVMe Storage Backend
Persist block data with redundancy and replication
Ensures durability and performance
6
Object Storage → Distributed Object DB
Store and retrieve object data with replication and consistency
Provides scalable and durable object storage backend
7
File Storage → Metadata Service
Update file metadata and permissions
Maintains consistency and access control

Practice

(1/5)
1. In a system designed for 99.999% availability, at step 4 the Delivery Worker checks the message queue for pending retries. What happens if the message is not acknowledged by the consumer within the visibility timeout?
easy
A. The message is archived permanently without retry
B. The message is deleted immediately to prevent duplicates
C. The message becomes visible again for redelivery to another consumer
D. The Delivery Worker blocks until the consumer acknowledges

Solution

  1. Step 1: Trace Delivery Worker decision at Step 4 -- message visibility timeout

    If the message is not acknowledged within the visibility timeout, it becomes visible again for redelivery to ensure no message loss.
  2. Step 2: Eliminate incorrect options

    Immediate deletion (A) risks message loss; archiving without retry (C) breaks availability; blocking (D) reduces throughput and availability.
  3. Final Answer:

    Option C -> Option C
  4. Quick Check:

    Visibility timeout expiry -> message re-queued for retry [check]
Hint: Visibility timeout expiry -> message re-queued for retry [check]
Common Mistakes:
2. A real-time ML inference system must serve predictions with minimal latency while allowing safe model updates without downtime. Which component best enables seamless model rollout with instant rollback capability?
easy
A. Shadow mode deployment that runs new models in parallel without affecting live traffic
B. A/B testing framework that splits traffic evenly between models
C. Batch inference pipeline that processes data offline and updates predictions periodically
D. Feature store that caches input features for faster model access

Solution

  1. Step 1: Identify deployment strategies for safe model updates

    Batch inference (C) is offline and adds latency, so it doesn't support real-time rollout. Feature store (D) optimizes input features but doesn't handle rollout or rollback. A/B testing (A) splits live traffic, risking user experience if the new model is faulty.
  2. Step 2: Understand shadow mode benefits

    Shadow mode (B) runs new models in parallel on live data without affecting production responses, enabling validation and instant rollback if issues arise.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Shadow mode runs new models safely alongside production [check]
Hint: Shadow mode isolates new models without impacting live traffic [OK]
Common Mistakes:
3. In the URL shortener system, at step 5 the Redirect Service receives a short code and queries the Cache before the Database. What happens if the Cache lookup misses at this step?
easy
A. The Redirect Service returns a 404 error immediately without querying the Database
B. The Redirect Service queries the Database for the original URL, then updates the Cache with the result
C. The Redirect Service generates a new short code and stores it in the Cache
D. The Redirect Service queues the request for later processing by an asynchronous worker

Solution

  1. Step 1: Trace Redirect Service behavior at Cache miss

    Cache miss means the short code is not in memory; the service must fetch the original URL from persistent storage.
  2. Step 2: Confirm Cache update after DB fetch

    After retrieving from DB, the service updates the Cache to speed up future requests.
  3. Final Answer:

    Option B -> Option B
  4. Quick Check:

    Cache miss triggers DB lookup and Cache update [check]
Hint: Cache miss -> DB lookup -> Cache update [check]
Common Mistakes:
4. In a pub-sub system, at step 4 the Delivery Worker reads a message from the topic partition and checks the subscriber's offset. What happens if the subscriber's offset is behind the latest committed offset?
easy
A. The Delivery Worker deletes the message from the topic partition
B. The Delivery Worker skips the message and moves to the next one
C. The Delivery Worker delivers the message to the subscriber and updates the offset
D. The Delivery Worker blocks until the subscriber catches up

Solution

  1. Step 1: Understand subscriber offset semantics

    The subscriber offset tracks the last consumed message. If behind, the Delivery Worker must deliver pending messages to catch up.
  2. Step 2: Delivery Worker behavior

    It delivers the message at the subscriber's offset and then updates the offset to the next message. Skipping or deleting messages (Options A and C) breaks delivery guarantees. Blocking (The Delivery Worker blocks until the subscriber catches up) is unnecessary and stalls the system.
  3. Final Answer:

    Option C -> Option C
  4. Quick Check:

    Delivery Worker delivers and advances subscriber offset [check]
Hint: Subscriber offset behind -> deliver message and update offset [check]
Common Mistakes:
5. Without the message broker (e.g., Kafka) in a high-throughput chat system, what exactly breaks in the message delivery flow?
medium
A. Messages are sent synchronously causing sender blocking and message loss on receiver failure
B. Alice's send operation blocks until Bob's server responds; if Bob's server crashes, the message is lost with no retry
C. Messages are encrypted incorrectly causing security breaches
D. The system automatically switches to batch mode causing high latency

Solution

  1. Step 1: Role of message broker

    Broker decouples sender and receiver, enabling asynchronous delivery and retries.
  2. Step 2: Consequence of missing broker

    Without it, messages are sent synchronously causing sender blocking; if receiver crashes, messages are lost; encryption (A) unaffected; blocking and loss (C) is exact failure; batch mode (D) not automatic.
  3. Final Answer:

    Option A -> Option A
  4. Quick Check:

    Broker removal causes blocking sends and message loss on receiver failure [check]
Hint: No broker means synchronous sends block and lose messages [check]
Common Mistakes:
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard