Skip to content

Blob and Object Storage

intermediate · 30 min · Asked often · Last reviewed 31 Oct 2026 · by TheLearningLoop Team

Key takeaways

  • Store file bytes in object storage and metadata in a database. Objects are immutable, so a change means writing a new object.
  • Let clients upload straight to storage with a presigned URL, so your servers do not carry the bytes.
  • Split large files into checksummed chunks (multipart upload), so a failure resends only the missing or damaged piece.

Why you need object storage, and when to use it

Photos, videos, documents, backups and logs are large files that are written once and read many times. Storing them in a database makes it huge and slow, and storing them on one server's disk risks losing them and limits how many can be kept. Object storage keeps each file as an object (the bytes plus metadata) under a key in a bucket, spread across many machines and copied for durability.

It gives you two things interviewers always ask about:

  • Durability: objects are copied across machines or zones, so a failed disk does not lose data.
  • Scalability and cost: capacity grows almost without limit at a low price per gigabyte, and the application servers stay stateless.

Use it when:

  • You store user uploads, media, backups, logs or datasets.
  • Files are large and read as a whole, or by ranges.
  • You want to serve files through a CDN straight from storage.
  • Data must survive hardware failures cheaply.

Skip it, or use something else, when:

  • You need fast random updates inside a file or transactions across files: use a database or a file system.
  • Objects are tiny and queried by content: use a database.
  • You need very low latency for hot data: put a cache in front or use a block volume.

Try it

Upload a 100 MB file over a network that can fail. Compare one request against chunks.

Blob and Object Storage

Step 1 of 4 · Press Space to play, arrow keys to step

Upload starts

Client0 MB sent

file is 100 MB

Upload serviceone requestObject storenothing yet

Initial state. A 100 MB file must reach the object store over a network that can fail.

tick:
0
MB sent:
0
wasted MB:
0
attempts:
1

1 tick = one step of the simulation.

Terms used in the counters: wasted MB is data sent that had to be sent again, attempts counts upload tries, and a tick is one step of the simulation. A CDN is a network of caches near users, a queue holds messages for background workers, and a lifecycle rule is an automatic rule such as "delete abandoned parts after 7 days".

Things to try:

  • Run One request with Connection drops at 70%. The whole upload restarts and 70 MB are wasted.
  • Switch to Chunks with the same failure. Only the lost chunk is sent again.
  • Choose One piece arrives damaged with both. See how a checksum per chunk limits the repair.

Storage choices

KindHow it stores dataGood whenWeakness
Object storageImmutable objects by key, over HTTPMedia, backups, data lakesNo in-place edits, higher latency than a disk
Block storageRaw disk volumes attached to a serverDatabases and operating systemsTied to one machine, you manage the file system
File storageA shared file system with folders and locksShared files for several serversHarder to scale, more expensive
Database blob columnThe file inside a rowTiny files that need a transactionBloats the database and backups

Direct upload vs uploading through your servers

  • Through your servers: the client sends the file to your API, which forwards it to storage. It is simple, but your servers carry all the bytes and become the bottleneck.
  • Direct upload with a presigned URL: your API checks permission, then gives the client a time-limited signed URL. The client uploads straight to storage, and your servers handle only small requests. This is the usual choice at scale.

How a large upload works

  1. The client asks your API for permission to upload and receives a presigned URL (or a set of them) valid for a few minutes.
  2. For large files the client starts a multipart upload and splits the file into chunks of a few megabytes.
  3. Each chunk is uploaded on its own, possibly in parallel, with a checksum. The store rejects a chunk whose checksum does not match.
  4. If the connection drops, the client asks which chunks are stored and resumes with the missing ones.
  5. When all chunks are in, the client completes the upload and the store joins them into one object.
  6. The store sends an event (for example to a queue) so other services can process the file, such as making thumbnails. Events are usually delivered at least once, so a worker may see the same event twice and must be idempotent (doing it twice gives the same result).
  7. Abandoned partial uploads are cleaned up by a lifecycle rule.

Object storage vs the alternatives

ConcernObject storageDatabase blobsServer disk
CapacityPractically unlimitedLimitedLimited
DurabilityVery high, copiedHighLow
Cost per gigabyteLowHighMedium
Edit part of a fileNoYesYes
Serve through a CDNEasyAwkwardAwkward
Best forFiles and mediaTiny filesTemporary data

Object storage wins for files. Keep the metadata (owner, name, size, permissions) in a database and only the bytes in object storage.

What a presigned URL allows

A presigned URL is a bearer credential: anyone who holds it can use it until it expires. Scope it tightly.

  • One method (PUT or GET), one key, and a short expiry.
  • Where the provider supports it, restrict size and content type (for example with signed headers or a POST policy), and still validate the file after upload.
  • Give each user a key prefix you control, never a name the client chooses.

A rough estimate

A 100 MB file split into 10 MB chunks is 10 requests, plus one to start and one to complete. If the connection drops at 70%, a single request resends 100 MB (170 MB sent in total), while chunks resend at most the chunk in flight. Larger chunks mean fewer requests but more resent data on a failure; smaller chunks mean the opposite. Providers set limits on chunk size, number of chunks and object size (Amazon S3, for example, allows up to 10,000 parts per object), so check your provider's documentation.

Avoiding a new single point of failure

  • Durability comes from the provider copying objects across zones. For critical data, add cross-region replication and versioning, which keeps older copies when an object is overwritten or deleted.
  • Access: serve through a CDN so a storage hiccup does not break every page.
  • Metadata database: replicate it. An object with no metadata row is effectively lost, so write the row and the object in a safe order and reconcile regularly.

You accept higher latency than a local disk and no in-place edits in exchange for durability and scale. Consistency rules differ between providers (Amazon S3 has been strongly consistent for reads and lists since 2020, but older or self-hosted systems may not be), so check yours.

When the object and the row disagree

Step orderCrash between the two writesRepair
Write the object, then the rowAn orphan object with no row (wasted money, no user impact)A periodic job lists objects and deletes those with no row after a grace period
Write the row, then the objectA dangling row pointing at nothing (users see a broken file)Harder: mark the row pending and only show it once the object exists

Prefer object first, then row, and reconcile regularly.

Common mistakes

  • Streaming uploads through application servers. Use presigned URLs.
  • One huge request for big files. Use multipart upload with resume.
  • Public buckets by accident. Default to private and serve through signed URLs or a CDN.
  • Trusting the file name or type. Validate content, size and type, and scan for malware.
  • No lifecycle rules. Abandoned uploads and old versions pile up and cost money.
  • No link between the row and the object. Deleting one and not the other leaves orphans.

How to talk about object storage in an interview

  • Say the files go to object storage, with metadata in a database and a CDN for reads.
  • Describe the presigned URL flow and multipart upload with checksums and resume.
  • Mention durability (copies, versioning, replication), access control, lifecycle rules and events for processing.
  • Name the trade-off: objects are cheap and durable but cannot be edited in place, so a change means writing a new object.

Where you meet object storage in real systems

Almost every product that accepts uploads uses it for profile photos, attachments, exports and backups. Here are three drawn out, the first with a short script you can run, then more examples.

Example 1: Multipart upload and a lifecycle rule

Object stores accept a large file as numbered chunks, check each chunk and join them when asked. The script below shows the idea with a dictionary standing in for the store. Open the example below to see the picture and the code.

Checksummed, resumable chunksSetup a short scriptCode no libraries
Ask for a URLAPI checks permissionUpload chunksstraight to storageCompletestore joins chunksEventprocess the file
The API checks permission and hands out a signed URL. The client uploads chunks straight to storage, and the store joins them. An event then triggers processing.
# Split a file into chunks, give each a checksum, and resume after a failure.
# The "store" below is a dictionary that stands in for an object store. No libraries are needed.
import hashlib

CHUNK = 4                                   # bytes per chunk, tiny so the output is easy to read
data = b"hello object storage"
store = {}                                  # chunk number -> (bytes, checksum the server accepted)

def upload_chunk(number, chunk, checksum, damage=False):
    sent = chunk[:-1] + b"?" if damage else chunk          # simulate corruption on the wire
    if hashlib.sha256(sent).hexdigest() != checksum:        # the server verifies every chunk
        return False                                        # rejected: only this chunk is sent again
    store[number] = (sent, checksum)
    return True

chunks = [data[i:i + CHUNK] for i in range(0, len(data), CHUNK)]
sent_count = 0
for number, chunk in enumerate(chunks):
    checksum = hashlib.sha256(chunk).hexdigest()            # computed by the client before sending
    ok = upload_chunk(number, chunk, checksum, damage=(number == 2))   # chunk 2 arrives damaged once
    sent_count += 1
    if not ok:
        ok = upload_chunk(number, chunk, checksum)          # resend just that chunk
        sent_count += 1
    assert ok

# Resume: after a dropped connection, ask which chunks are stored and send only the missing ones.
missing = [n for n in range(len(chunks)) if n not in store]

joined = b"".join(store[n][0] for n in sorted(store))        # "complete the upload": join the chunks
assert joined == data and not missing
print(len(chunks), "chunks,", sent_count, "sends")

The Python script was run with Python 3: one damaged chunk was rejected and resent, and the joined result matched the original. It shows the idea only: it damages one chunk and resends it, but it does not simulate a dropped connection, so the resume step just lists the missing chunks. Real S3-style stores offer the same steps as multipart upload calls, which I could not test here, so check your provider's documentation for the exact calls.

Example 2: Metadata and bytes live apart

The database holds the information about the file. Object storage holds the bytes. A queue connects them to background work.

ClientAPIMetadata DBObject storeQueueWorkers
The client uploads bytes directly to object storage. The API records metadata in a database. A storage event goes on a queue so a worker can make thumbnails.

Example 3: Chunks of a large upload

Each chunk has its own checksum. A damaged or lost chunk is sent again without touching the others.

Stored1234567To send8910
Chunks 1 to 7 are stored. Chunk 8 was interrupted. The client resumes at chunk 8, and chunks 1 to 7 are never sent again.

More real-world scenarios

4. Profile pictures

The app asks for an upload URL, the client uploads directly, and a worker creates several sizes. The page uses a CDN URL.

5. Document and attachment storage

Files belong to users or teams. The database keeps the owner and permissions, and downloads use short-lived signed links.

6. Backups and archives

Databases and logs are copied to cheap storage, with rules that move old data to colder, cheaper tiers.

7. Data lakes

Raw events are written as files, and analytics engines read them straight from storage when they run queries.

8. Static websites and assets

Pages, images and scripts are served from a bucket through a CDN, with no servers to run.

9. Video and audio

Originals and transcoded segments are objects, and the CDN serves them to players.

10. Software releases

Build outputs are stored once with a version and fetched by deployment tools.

Tools and managed services

KindNameNotes
ManagedAmazon S3, Google Cloud Storage, Azure Blob StorageHosted object storage
Self-hostedMinIO, CephS3-compatible storage you run yourself
CDNAmazon CloudFront, CloudflareServe objects near users
ToolsAWS CLI, MinIO client (mc)Upload, share and manage objects
EventsStorage event notifications to queuesTrigger processing when an object arrives

The takeaway

Whenever a design stores files, put the bytes in object storage, the metadata in a database, and let clients upload straight to storage with a signed URL.

Interview questions

Try answering out loud before you reveal hints. Interviewers care about how you reason, not just the final answer.

  1. 1.

    Design the upload of profile pictures and large videos. How do the bytes reach storage?

    medium
  2. 2.

    Where do you keep the file name, owner and permissions, and why not in the object store?

    easy
  3. 3.

    How do you make sure an uploaded file is never lost?

    medium
  4. 4.

    Users should only download their own files. How do you enforce that?

    medium
  5. 5.

    A user edits a small part of a 2 GB file. Why is object storage a poor fit, and what do you do?

    hard

Finished this lesson?

Progress is saved on this device. Create a free account to keep it everywhere.

Topics:Object storageS3Blob storagePresigned urlMultipart uploadFile uploadCdn

↑ Back to top

Next lesson