Stage 2 · Building blocks · Easy · 15 min

Object storage and large files

Where the bytes go: files in object storage, metadata in a database. Clients upload directly with presigned URLs, large files upload in chunks, and delivery goes through a CDN.

What each interview level is expected to know

Learn first: CDNs and edge caching, Choosing a database and modelling data

After this lesson you can:

  • Keep file bytes in object storage and their details in a database.
  • Let clients upload directly with a presigned URL, and resume large uploads in parts.
  • Serve popular files through a CDN, and move old files to cheaper storage.

Start here

See it in 60 seconds

How a big file gets stored

Big files go straight from the app to object storage in parts, while a small database keeps the facts about each file.

Scene 1 of 6 · Bytes and facts apart

The video bytes go to object storage, and the facts about it, like owner and size, go in a database.

Phone appPhone appAPI serverAPI serverObject storageObject storagethe bytesDatabase, file recordsDatabasefile recordsthe factsCDN edge, near viewersCDN edgenear viewers
  • Phone app — healthy
  • API server — healthy
  • Object storage — healthy — the bytes
  • Database — file records — healthy — the facts
  • CDN edge — near viewers — healthy
  1. Bytes and facts apart. The video bytes go to object storage, and the facts about it, like owner and size, go in a database.
  2. Ask, get a signed link. The app asks the API to upload; the API checks the user and returns a short-lived signed link.
  3. Straight to storage. The app sends the 1,000 MB video straight to storage in 10 parts of 100 MB each.
  4. Resend one part. If part 4 fails, only part 4 is sent again: 100 MB, not the whole 1,000 MB.
  5. Save the facts. The app tells the API every part is in, and the API saves the record: owner, name, size, key.
  6. Serve through a CDN. Viewers download from a CDN edge near them, which reads storage only on a miss.
  7. Now you try. Pick a file size and see how many parts the app sends. For example: A 1,000 MB file goes as 10 parts of up to 100 MB. If one part fails, only up to 100 MB is sent again, not all 1,000 MB.

Scene 1 of 6: Bytes and facts apart. The video bytes go to object storage, and the facts about it, like owner and size, go in a database.

Key points

  1. Object storage holds the bytes; a database holds the facts, such as owner, name and size.
  2. The API checks the user and hands out a short-lived signed link; it never carries the bytes.
  3. Big files go in parts, here 100 MB each, and a failed part is sent again on its own.
  4. Viewers download from a CDN near them, which reads object storage only on a miss.

In plain words

A user uploads a 1,000 MB video. The bytes go to : a large, cheap store that keeps each file whole under a key, such as videos/abc123.mp4. The facts about the file go in a database row: owner, name, size and that key. Amazon S3 is a well-known object store. Viewers later download the video through a near them.

The upload itself skips your servers. The app asks your server for a short-lived upload link, signed so it works for that one key only. The phone sends the 1,000 MB straight to the object store with that link, so your servers never hold the bytes. When the upload finishes, the app saves the database row. Viewers then get the file from the CDN, which fetches it from the store once.

The problem it solves

A 2 GB video uploaded through your API servers ties up a connection and memory for minutes. Storing it in a relational database instead bloats backups and . At millions of files you need storage that is cheap, keeps data safe, and grows without you managing disks.

Why it matters

Photos, videos, documents and backups show up in many common interview problems — file sync, video streaming, social feeds. Putting large files in your main database, or streaming them through your API servers, is a classic design mistake.

A worked example

A 2,000 MB video splits into 20 equal parts for upload. If one part fails partway through, only that one part needs to be resent, not the whole file, since 2,000 ÷ 20 = 100 MB per part.

Think of it like…

Think of a coat check. You hand over a coat and get a numbered ticket. You keep the small ticket, and the cloakroom keeps the heavy coat.

Where this analogy stops working

A small record that points to a big item is the useful part. But you can take one thing out of a coat pocket. Object storage has no such edit: to change a file you upload the whole object again. Each read is also a network request, slower to start than a local disk.

Try it

See it working

Case study · Live model

How an object store keeps data safe

An object store keeps files, here called objects, on 12 data nodes: servers full of disks. Each object is on several nodes, as full copies or as pieces, so that a failed node does not lose it. Fail one node, then two, then three, and watch which objects survive.

Try it

Lab time 3.0 s
where?piecesrebuildClients, 10 reads a secondClients10 reads a seconduploads: 1 a secondAPI servers, place each objectAPI serversplace each object0 reads openMetadata, where each piece isMetadatawhere each piece is205 objects listedData nodes, 12 of 12 upData nodes12 of 12 up36.9 GB storedRepair job, nothing to rebuild, IDLERepair jobnothing to rebuild0 rebuiltIDLE
  • Clients — 10 reads a second — healthy — uploads: 1 a second
  • API servers — place each object — healthy — 0 reads open
  • Metadata — where each piece is — healthy — 205 objects listed
  • Data nodes — 12 of 12 up — healthy — 36.9 GB stored
  • Repair job — nothing to rebuild — IDLE — 0 rebuilt
  • A read
  • An upload
  • Find the pieces, then fetch them
  • The object
  • The repair job rebuilds a piece
  • A read of a lost object
Disk used
3.0 ×
36.9 GB for 12.3 GB of objects
Whole
205/ 205
objects with all 3 copies
At risk
0
0 could not lose one more
Lost
0
objects that cannot be rebuilt
Slow reads
0
had to rebuild a missing piece first
Safe again after
–
from the last failure to every piece rebuilt

Numbers add up:205 objects = 205 whole + 0 at risk + 0 lost · 41 reads = 41 normal + 0 slow + 0 failed + 0 in progressThe lab checks this sum as it runs, so a counting mistake would show here.

Controls

How an object is kept
Kept as

The whole object is written to 3 nodes. Any one copy is enough to read it. A new choice starts the model again.

Failures and repair
600 MB a second

How much the repair job can read each second. Rebuilding one coded piece means reading 4 others.

A failed node loses everything on it. An empty node takes its place after 3 s.

Traffic
10 a second
1 a second

Objects

StateObjectsWhat it means
Whole205Every copy is on a node that is up.
At risk0Something is missing, but enough is left to read the object and to rebuild the rest.
One from loss0Counted in "At risk" too: these have exactly the 1 they need, and no spare.
Lost0Fewer than 1 left. Nothing can bring the object back.

Node by node

NodeStateCopies heldStored
Node 1up412.5 GB
Node 2up503.0 GB
Node 3up382.3 GB
Node 4up472.8 GB
Node 5up492.9 GB
Node 6up623.7 GB
Node 7up613.7 GB
Node 8up472.8 GB
Node 9up643.8 GB
Node 10up573.4 GB
Node 11up422.5 GB
Node 12up573.4 GB
Objects at risk, and objects lost
At riskLost
00.30.50.811s2s3s
Show data table
TimeAt riskLost
1s00
1s00
2s00
2s00
3s00
3s00

What just happened

Nothing yet. Start traffic or run an experiment.

What this model simplifies
  • Every object is 60 MB, and the store starts with 200 of them on 12 nodes. A real store holds billions of objects of every size on thousands of nodes.
  • A whole node fails at once and loses all its data. Real failures are more often one disk, or a node that is cut off for a while and comes back with its data.
  • The nodes are not grouped. Real stores spread the pieces of an object over racks and data centres, so that one power cut cannot take several pieces.
  • A normal read takes 40 ms and a read that must rebuild a piece 160 ms. Real numbers depend on the size of the object.
  • Three nodes that fail in the same moment cost 1 object in 200 here with copies, and about 20 with pieces. An object in 6 pieces has more nodes to lose. Real stores have far more nodes and repair fast, which makes three losses at once very rare.
  • One repair job rebuilds one piece at a time. Real stores run many repairs side by side, and slow them down when clients are busy.
  • The metadata is one box that never fails. In a real store it is a database of its own, with its own copies.

Mechanics

How it works

The pictures follow this page's example: a user uploads a 1,000 MB video from a phone. The first shows where the bytes travel. The second shows what happens when the connection drops halfway.

  1. Separate metadata from bytes

    Keep a record for each file in a database: owner, name, size, checksum and object key. Keep the bytes in object storage under that key. The record is small and easy to query. The bytes are large and are only fetched by key.

  2. Upload directly with a presigned URL

    Pick a case to follow below

    With this case: Every byte went through your API: 1,000 MB in and 1,000 MB out again. A busy upload page needs many API servers only to carry videos.

    Phone app, a 1,000 MB videoPhone appa 1,000 MB videoYour API, checks and signs, SLOW, NOWYour APIchecks and signscarries 1,000 MBSLOWDatabase, one row per fileDatabaseone row per fileObject storage, keeps the bytesObject storagekeeps the bytes
    • Phone app — a 1,000 MB video — healthy
    • Your API — checks and signs — SLOW — NOW — carries 1,000 MB
    • Database — one row per file — healthy
    • Object storage — keeps the bytes — healthy
    • Bytes
    • Request
    Step 1 of 3

    Step 1 of 3 · Your API

    Watch: The app sends all 1,000 MB to your API

    What happens
    Your API server receives the whole video, and holds a connection open for as long as that takes.
    Why
    The API is the only address the app knows.
    What changes
    Your servers carried 1,000 MB they will not keep.
    Next
    The API passes the bytes on to object storage
    MB through your API
    1000
    Watch: your servers carried the video
    MB in object storage
    0
    of 1000
    Database row
    none

    Step 1 of 3: Your API. The app sends all 1,000 MB to your API. Your API server receives the whole video, and holds a connection open for as long as that takes.

    The app tells your API it wants to upload. After a permission check, the API hands back a presigned URL. This is a link, signed by your server, that allows an upload to one key for a few minutes. The app then sends the file straight to object storage, so your API servers do not carry the bytes.

    In the picture, compare the two ways. Through your API, all 1,000 MB crosses your servers twice: in from the phone and out to storage. With a presigned URL, your API answers two small requests, and the bytes go straight from the phone to storage.

    Here the link works for 10 minutes. The row in the database stays pending until the upload finishes, so a broken upload never shows up as a video.

  3. Chunk large files

    Pick a case to follow below

    With this case: As one piece, the upload started over: 1,750 MB sent for a 1,000 MB file.

    Phone app, a 1,000 MB video, FAILED, NOWPhone appa 1,000 MB videoconnection lostFAILEDYour API, checks and signsYour APIchecks and signsDatabase, one row per fileDatabaseone row per fileObject storage, keeps the bytesObject storagekeeps the bytes
    • Phone app — a 1,000 MB video — FAILED — NOW — connection lost
    • Your API — checks and signs — healthy
    • Database — one row per file — healthy
    • Object storage — keeps the bytes — healthy
    • Broken upload
    • Bytes
    Step 1 of 2

    Step 1 of 2 · Phone app

    Failed: The connection drops at 750 MB

    What happens
    The file was sent as one piece, and the piece is not finished.
    Why
    Storage keeps an object only when the whole of it arrives.
    What changes
    Nothing is kept.
    Next
    The app starts again from the beginning
    MB sent
    750
    nothing sent twice
    MB kept by storage
    0
    of 1000

    Step 1 of 2: Phone app. The connection drops at 750 MB. The file was sent as one piece, and the piece is not finished.

    What these pictures simplify. These pictures use one 1,000 MB file and parts of 100 MB, so the numbers stay round. Real stores set their own part sizes, often a few megabytes or more. The S3-style storage case study above runs many uploads.

    Split a large file into parts of a few megabytes each. Parts upload in parallel. If one part fails, the app retries that part alone, so an interrupted upload carries on from where it stopped. Identical parts can be stored once.

    In the picture the parts are 100 MB each, so the numbers stay round. The connection drops at 750 MB. Sent as one piece, the upload starts over, and 1,750 MB crosses the network for a 1,000 MB file. In parts, only the broken part is sent again: 1,050 MB in all.

  4. Serve through a CDN

    Downloads come from edge caches near the user. The CDN reads object storage only on a .

  5. Tier by access pattern

    Files that are rarely read can move to a cheaper storage class. Keeping them there costs less, and reading them back costs more or takes longer. A rule can move them by age, such as after 90 days.

Use it when

  • Large files such as images, video, documents, backups and logs: they are written once and read whole.
  • Any design where users upload or download files: keep the bytes off your API servers and out of your database.

Skip it when

  • Small records that change often: an object is replaced whole on every change, so use a database.
  • Data you must find by anything other than its key: keep those fields in the database record.

Check yourself

How does an app usually let users upload large files straight to object storage?

Judgement

Trade-offs and how it fails

What you give up

Cost
Object storage costs far less for each gigabyte than a database or a server's own disk. You also pay for each request and for data sent out, which adds up for busy files.
Latency
Each read is an request, so the first byte arrives later than from a local disk. Put a CDN or a in front of files that are read often.

Failure modes

  • Orphaned files: the upload succeeds but the database write fails, or the reverse. That leaves bytes with no record, or a record with no bytes. A cleanup job that compares the two finds them.
  • A file that suddenly gets popular: every download hits object storage, and you pay for each one. Serve it through the CDN.
  • A leaked presigned URL: anyone who has the link can use it until it expires. Make each one last minutes, for one object and one action.

In the real world

  • Amazon says S3 is designed for 99.999999999% durability, known as eleven nines. Its standard class stores each object across at least three separate sites. Source: Amazon S3 FAQs (checked 14 October 2026)
  • Dropbox splits files into blocks and identifies them by hash, so a changed file only re-uploads the blocks that changed.

Trade-offs to be ready to discuss: Object storage vs database blob · Direct upload vs proxy upload

Check yourself

Why keep a file's owner and name in a database, not only in object storage?

Interview

What interviewers look for

  • Say it early: "Metadata in a database, bytes in object storage, uploads through presigned URLs."
  • For large files, mention chunked, resumable uploads.
  • Put a CDN in front of downloads, and say how an updated file gets a new URL or is invalidated.

Say it out loud: Why upload through a presigned URL instead of through your API servers?

A 4 GB upload fails at 90% on a mobile connection. Which design lets the user resume without starting over?

Expected depth by interview level

Levels describe the depth interviewers probe, not years of experience. Choose a level on the learning path to highlight it.

JuniorExpected
Files in object storage, metadata in a database.
MidCore
Presigned uploads, chunking, CDN delivery.
SeniorExpected
Uploads that resume, storing the same data once, and keeping records and files in step.
StaffUseful
Storage tiering and cost at scale.

Practice

Apply it

Three harder questions

The first two use the idea on a new case. The last asks you to judge a design.

Apply it

A 1,000 MB video uploads in 10 MB parts. Part 37 fails. What does the app send again?

Apply it

A 50 MB file in object storage is suddenly downloaded 1 million times a day, straight from the store. What grows fast, and what fixes it?

Judge a design

Each upload goes to the API servers, which pass the bytes on to object storage. Uploads are slow, and the API servers run short of bandwidth. What is the better design?

Next: message queues, which let slow work, such as converting an uploaded video, happen in the background.

Go deeper

Sources and further reading

First-hand sources to check this page against and to go further. They are standards, official docs, original papers, and guides from engineering and security teams. Each link was opened on 8 November 2026.