Topic 079 / Core
Object storage and file storage: multipart and resumable uploads, checksums
Chapter 5.6 · Operational Storage and the Data Lifecycle
What and why
Large or unstructured blobs — images, videos, backups — don't belong in database rows; they belong in object storage, addressed by key over an HTTP API, with only their metadata kept in the database. Builds on: → 58 (database fundamentals).
Diagram
| Object storage | File storage | Database | |
|---|---|---|---|
| Shape | flat key → blob | hierarchical paths | structured rows |
| Access | HTTP API | POSIX-like | SQL/driver |
| Durability | very high | varies | varies |
| Fit for large blobs | yes | yes | no |
How it works
- Store large or unstructured blobs in object storage addressed by a key; keep only metadata (key, size, content type, checksum) in the database.
- Multipart upload: split a large object into parts, upload parts (optionally in parallel), then complete the upload by referencing all part ids.
- Resumable uploads: the client tracks which parts succeeded and retries only the missing ones, instead of restarting the whole transfer.
- Checksums: compute a hash of each part, and of the whole object, so corruption in transit or in storage is detected rather than silently accepted.
Practical example
(illustrative). A 2 GB video file split into 20 parts of 100 MB each; part 14 fails on a flaky connection. Only part 14 is retried — not the full 2 GB — and its checksum is verified before the upload is marked complete.
When to use it
- Use when: any blob beyond a small size threshold, and always for media, backups, or large files.
- Avoid when: storing large binary blobs directly in relational database rows — it bloats backups, slows queries touching that table, and wastes a transactional engine's strengths on data that doesn't need them.
- Failure scenarios: an interrupted large upload with no multipart/resume support, forcing a full restart from zero; a corrupted upload accepted silently because no checksum was ever verified.
- Simpler alternative: for small files (icons, tiny attachments), a single-request upload with a checksum is enough — no multipart needed.
Practice
(20 min, no lab needed — object storage isn't in the shared lab). Design, on paper, the metadata table the application would maintain for uploaded files (key, size, checksum, upload status, parts completed) while the objects themselves live in object storage. Describe the retry logic for a single failed part under a multipart upload. Done when the metadata table covers every state a failed upload can be left in, and the retry re-uploads only the failed part.
Key takeaway
Keep blobs in object storage, metadata in the database — never the reverse. Done when you can: design a metadata table for an object-storage-backed upload and describe its resume path. Used next in → 89 (CDN delivery of stored objects); Projects 17, 18.
References
None — this topic makes no external claims.
Source directory