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 app — healthy
- API server — healthy
- Object storage — healthy — the bytes
- Database — file records — healthy — the facts
- CDN edge — near viewers — healthy
- Bytes and facts apart. The video bytes go to object storage, and the facts about it, like owner and size, go in a database.
- Ask, get a signed link. The app asks the API to upload; the API checks the user and returns a short-lived signed link.
- Straight to storage. The app sends the 1,000 MB video straight to storage in 10 parts of 100 MB each.
- Resend one part. If part 4 fails, only part 4 is sent again: 100 MB, not the whole 1,000 MB.
- Save the facts. The app tells the API every part is in, and the API saves the record: owner, name, size, key.
- Serve through a CDN. Viewers download from a CDN edge near them, which reads storage only on a miss.
- 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
- Object storage holds the bytes; a database holds the facts, such as owner, name and size.
- The API checks the user and hands out a short-lived signed link; it never carries the bytes.
- Big files go in parts, here 100 MB each, and a failed part is sent again on its own.
- 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 huge, cheap store for files such as photos and videos. Each file is saved whole under a key, such as video.mp4.): 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 (A content delivery network: many servers around the world that keep copies of files close to the people who ask for them.) 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 (Continuously copying every write from a primary database to one or more replicas, so each one ends up with the same data.). 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
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.
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.
Upload directly with a presigned URL
Pick a case to follow belowWith 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 video Phone app a 1,000 MB video Your API, checks and signs, SLOW, NOW Your API checks and signs carries 1,000 MB SLOW Database, one row per file Database one row per file Object storage, keeps the bytes Object storage keeps 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 3Step 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 API1000Watch: your servers carried the videoMB in object storage0of 1000Database rownoneStep 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.
Chunk large files
Pick a case to follow belowWith 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, NOW Phone app a 1,000 MB video connection lost FAILED Your API, checks and signs Your API checks and signs Database, one row per file Database one row per file Object storage, keeps the bytes Object storage keeps 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 2Step 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 sent750nothing sent twiceMB kept by storage0of 1000Step 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.
Serve through a CDN
Downloads come from edge caches near the user. The CDN reads object storage only on a (A read the cache cannot answer because the value is not there. The app reads the database instead.).
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
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 (The rules an app or browser uses to ask a server for something and get an answer, such as GET /profile/42 and then 200 OK.) request, so the first byte arrives later than from a local disk. Put a CDN or a (A small, fast store that keeps copies of popular data, so most reads skip the slower database.) 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
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?
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
Apply it
Judge a design
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.
- Official docsWhat is Amazon S3?AWS documentationBuckets, keys, storage classes and the consistency S3 gives on reads after writes.
- Official docsUploading and copying objects using multipart uploadAWS documentationSending a large file in parts that can be retried one at a time.
- Official docsDownload and upload objects with presigned URLsAWS documentationLetting a browser upload straight to storage with a link that expires.