Object / Blob Storage
Definition
Object storage
- In plain English
- Object storage keeps files of any size as objects, each found by a unique key, in a service built to hold practically unlimited data.
- Think of it like
- It is like a vast warehouse where every box has a barcode and staff fetch any box by scanning it.
Blob
- In plain English
- A blob, short for binary large object, is a chunk of raw file data such as an image or audio file.
- Think of it like
- It is like a sealed box whose contents the warehouse never opens.
Why it exists
You put 60 MB audio files in episode rows. Backups grow, and database traffic now includes every audio download.
Keep searchable facts in the database. Let a file-oriented service handle the large file traffic.
How it works
Metadata
- In plain English
- Metadata is data about data, such as a file's name, size, owner and upload date.
- Think of it like
- Like the label on the box.
Pre-signed URL
- In plain English
- A pre-signed URL is a temporary link that lets a client upload or download one specific object directly, without passing through your servers.
- Think of it like
- Like a warehouse pass that works for one box until it expires.
- Request permission
The client asks your API for an upload link; the API checks who may upload.
- Issue a limited link
The API chooses an object key and returns a short-lived pre-signed upload URL.
- Upload directly
The client sends the file to object storage.
- Verify completion
Your API verifies the object exists and meets required size and type rules before saving its key and metadata.
- Download later
After checking access, issue a pre-signed download link or serve public files through a nearby delivery network.
The client requests a link, uploads directly to storage, and notifies the API; the API verifies the object and saves metadata.
| Question | Database | Object storage |
|---|---|---|
| Best fit | Related, searchable facts | Large files fetched by key |
| Size limits | Row and field limits vary | Per-object and request limits vary |
| Cost per stored GB | Often higher for transactional storage | Often lower; requests and transfers add cost |
| Queries | Filter, combine, and summarize fields | Fetch objects; content queries need other tools |
A pre-signed URL works for one object and can be reused until it expires. Keep expiry times short, and treat the link like a password.
Object storage has per-object limits despite its large total capacity. Typical workflows replace whole files; check provider-specific operations before assuming edit support.
Examples
Store the key beside episode facts
Your audio files live in object storage. The episodes table holds searchable facts and each audio key.
CREATE TABLE episodes (
id INTEGER PRIMARY KEY,
title VARCHAR(200) NOT NULL,
duration_seconds INTEGER NOT NULL,
audio_key VARCHAR(500) NOT NULL
);
INSERT INTO episodes VALUES
(7, 'Designing a data layer', 1800, 'audio/episode-7.mp3');Search titles using the database. Fetch the audio by its key after checking whether the listener has access.
The insight
Use the database for facts and object storage for large files.
Issue short-lived image access
Each X-ray is a private 30 MB object linked from a patient record. An authorized doctor receives a five-minute download URL.
- Authorize
Check that this doctor may view this patient’s image.
- Issue and record
Create a five-minute link for that object and log the access decision.
- Audit downloads
Enable storage access logging if you need a record of actual downloads.
Anyone holding the URL may use it while valid, so treat it as a secret. Expiry does not erase already downloaded images.
The insight
Pre-signed links limit access duration but still require authorization and careful handling.
Keep photo bytes off app servers
Your 40,000 fans upload photos on Saturday night. Phones upload directly using limited links.
Phones request links from the app API and send photos directly to object storage; the API verifies uploads and saves facts in a database.
If each fan sends one 5 MB photo, storage receives 200,000 MB, or 200 GB in decimal units. Plan upload limits and cleanup for abandoned uploads.
The insight
Direct uploads keep large file traffic off your application servers.
Trade-offs
Pros
- Large capacity with lower storage cost in many cases.
- Direct transfers reduce app-server traffic.
- Managed services offer durable storage options.
Cons
- Keys and permissions need careful handling.
- Searching file contents requires other tools.
- Requests and data transfer can add significant costs.
Use when
- Images, audio, video, and exports dominate storage.
- Large files are retrieved by a known key.
Avoid when
- Small records need frequent filtering and joins.
- You require database-style changes inside file contents.
Quick check
Takeaways
- Store large files as objects and their searchable facts in a database.
- Pre-signed URLs grant scoped, temporary direct access.
- Verify uploads and keep large transfers off app servers.