AlgoViz

Requirements of a blob store

medium 24 min

Before building a store for photos, videos and backups, decide what it must do, how well, and how much of it.

Video lesson · Chapter 1 of 5

What exactly does an upload receipt promise

0:00 / 3:56

Theory

Read or listen first. About 2 min.

What it is

A blob is a binary large object: a photo, a video, a backup, a log file. A blob store keeps such objects under a name and gives the same bytes back later. It does not look inside them.

Its requirements are the agreement made before the design starts. Functional requirements say what people can do: store, fetch, list, delete. Non-functional requirements say how well: how durable, how available, how fast, how large, how safe.

Why it exists

The design follows from the requirements. A store for small private notes and a store for five-gigabyte videos have the same four operations, and need different machines, different networks and different APIs.

Most arguments in a design review are really about a requirement nobody wrote down. Is a lost file acceptable? May a read return the previous version? How big is the biggest file? Ten minutes of questions save weeks of rebuilding.

A short history

  1. 13 March 2006

    Amazon announces S3: storage for the internet behind a simple web interface.

  2. 10 November 2010

    S3 adds multipart upload, so large objects can be sent in parts, in parallel, with retries per part.

  3. 1 December 2020

    S3 becomes strongly consistent: a read after a successful write returns that write, and listings are accurate.

  4. 20 August 2024

    S3 adds conditional writes: create this object only if the name is not taken.

  5. 2 December 2025

    S3 raises its largest object from 5 TB to 50 TB. A reminder that limits are requirements too, and they change.

Words to know

Blob
Any bytes, stored and returned as one thing.
Bucket
A named container for blobs. Some products say container.
Key
The name of a blob, unique inside its bucket.
Durability
The chance that stored data still exists after a year.
Availability
The share of time in which requests succeed.
Non-goal
Something you have decided not to build now, written down.

How it works

Step through the idea, or press Play.

Step 1 of 3

Say what people do. Put, get, list and delete blobs by name

Understand it

Start here

Planning a costume store

A theatre wants one place for all its costumes. Before anyone buys a rack, Asha asks five questions. They are the same questions you ask about a blob store.

Five questions before the first rack

The racks come last. The inside of the store is the topic Inside a blob store.

Scope

Who uses it, and for what

  • Media

    Images, video and audio. Large, written once, read often.

  • Backups

    Database dumps and system images. Huge, rarely read, must not be lost.

  • Data lakes

    Analytics data, logs and training sets. Read in parallel by many machines.

  • Static assets

    Website files. The place a CDN fetches from.

  • Archives

    Records kept for years. Price per gigabyte matters most.

  • User files

    Uploads and attachments. Private, so access rules matter.

Ask which two or three of these matter. A store for backups can be slow to the first byte. A store behind a website cannot.

Inside the promise, outside the promise

An application calls the API of the blob store over HTTP. Inside the store, the API sends bytes to many disks and names to a metadata service holding bucket, key and size. Search and resizing sit outside the store and are marked as not our job.
Drawing the boundary is a requirement too.

Choose

Is a blob store the right kind of storage?

Blob or objectFileBlock
You seeFlat names and bytesDirectories and filesRaw numbered blocks
You useHTTP APIPOSIX calls over NFS or SMBA file system on iSCSI or Fibre Channel
ChangeReplace the objectEdit in placeEdit any block
MetadataAttached to each objectKept by the file systemNone
Best forWeb content, backupsShared file accessDatabases, virtual machines
More about the three kinds in object storage.

Which storage fits?

Whole objects, replaced rather than edited, fetched by name: that is the blob case.

Functional

What it must do

Core operations

OperationRequestMeaning
PutPUT /bucket/keyCreate or replace a blob
GetGET /bucket/keyFetch it
HeadHEAD /bucket/keyFetch only the metadata
ListGET /bucket?prefix=Names that begin with a prefix, page by page
CopyPUT with a copy-source headerCopy to a new key without downloading
DeleteDELETE /bucket/keyRemove it

Buckets need a few operations of their own: create (the name is globally unique), list the buckets of a user, delete (it must be empty first) and configure (access policy, CORS for browsers, logging).

Features to add when a use case asks for them

  1. 1

    Multipart upload

    Send a large file in parts. Parts travel in parallel, and only a failed part is sent again.

  2. 2

    Range requests

    Fetch some bytes of an object: seek in a video, continue a broken download.

  3. 3

    Presigned URLs

    A link that allows one operation for a limited time, so a client needs no account at the store.

  4. 4

    Versioning

    Keep earlier versions, so an overwrite or delete can be undone.

  5. 5

    Lifecycle rules

    Move old objects to cheaper storage, or expire them.

  6. 6

    Server-side encryption

    Encrypt the bytes before they reach a disk.

Promises

How well it must do it

Non-functional requirements, as numbers

QualityTargetWhat it means
Durability99.999999999% a yearEleven nines: data survives failed disks and buildings
Availability99.99%About 52.6 minutes of failed requests a year
ScaleExabytes, billions of objectsNo planned limit on the number of objects
LatencyAbout 100 to 200 ms to the first byteThe figure AWS gives for small S3 objects
ConsistencyRead after writeAfter a successful write, every read sees it
S3 Standard is designed for this durability and availability. Ours is a choice: an internal log store may need less.

What eleven nines means

10,000,000 objects×10−11 a year=10−4 a year⇒one object in 10,000 years10{,}000{,}000 \text{ objects} \times 10^{-11} \text{ a year} = 10^{-4} \text{ a year} \Rightarrow \text{one object in } 10{,}000 \text{ years}
An average of a design target. It does not cover a person who deletes the wrong bucket.

Durability

  • Is the data still there?
  • Copies or parity on separate hardware
  • Checksums and repair
  • A failure is permanent loss

Availability (a different promise)

  • Can I reach it now?
  • Spare servers, several zones
  • Failover and retries
  • A failure is a wait

Consistency

What a reader may see

With read-after-write consistency a successful put is visible to the next get. With eventual consistency a reader may see the previous bytes for a while, and every reader sees the new ones in the end. S3 was eventually consistent for overwrites and deletes until December 2020 and is strongly consistent now.

Read after write

The promise starts at the OK. A read during the upload may still get version 1.

Two writers to one key are a separate question. Without a condition, the last write wins and the other is lost. A conditional write (If-None-Match: *) says: only if the name is free. A cache or CDN in front can still show old bytes, whatever the store promises.

API

The requests, word for word

HTTP
PUT /bucket-name/path/to/object HTTP/1.1Host: blob.example.comContent-Type: image/jpegContent-Length: 102400x-amz-meta-custom: valueAuthorization: <signature>[binary data]HTTP/1.1 200 OKETag: "version-tag-of-these-bytes"GET /bucket-name/path/to/object HTTP/1.1Range: bytes=0-1023GET /bucket-name?prefix=images/&max-keys=100&continuation-token=... HTTP/1.1DELETE /bucket-name/path/to/object HTTP/1.1
The client chooses the key. The ETag identifies these bytes; it is not always an MD5 digest (it is not for a multipart upload).

Multipart upload in three calls

Initiate, upload parts, complete. Nothing is visible under the key before the last call. Full treatment: file upload APIs.

A presigned URL carries the permission in the link. Its query holds the algorithm, the credential scope, the date, the expiry in seconds and a signature. Changing any of them breaks the signature. Example, shortened and not valid:

Text
https://bucket.s3.amazonaws.com/key  ?X-Amz-Algorithm=AWS4-HMAC-SHA256  &X-Amz-Credential=...  &X-Amz-Date=20240101T000000Z  &X-Amz-Expires=3600  &X-Amz-Signature=...

Limits

Constraints to write down

Amazon S3, as a worked example (checked November 2026)

LimitValueConsequence
Largest object50 TBAbove 5 GB you must use multipart
Single PUT5 GBAdvice: multipart from about 100 MB
Parts per upload10,000, each 5 MiB to 5 GiBThe last part may be smaller
Key length1,024 bytes of UTF-8The prefix counts
ListingUp to 1,000 keys a pageCallers must follow pages
Requests per partitioned prefixAt least 3,500 writes or 11,000 reads a secondSpread a hot workload over prefixes
Bucket name3 to 63 charactersLowercase letters, numbers, periods, hyphens; starts and ends with a letter or number
Names are unique across all accounts in a partition. Keys may hold any Unicode characters and are unique in their bucket; a slash only looks like a folder.

Smallest part size that fits

part≥object size10,0001 TB10,000=100 MB10,000×5 GiB≈48.8 TiB\text{part} \ge \frac{\text{object size}}{10{,}000} \qquad \frac{1 \text{ TB}}{10{,}000} = 100 \text{ MB} \qquad 10{,}000 \times 5 \text{ GiB} \approx 48.8 \text{ TiB}
An 8 MB part size, fine for a photo album, stops at 80 GB.

Security

Who may do what

  1. 1

    Authentication

    Who is asking? Signed requests, roles or keys. Roles with short-lived credentials are safer than long-lived keys.

  2. 2

    Authorization

    May they do this here? Bucket policies, user policies and, in older setups, access control lists.

  3. 3

    Encryption

    TLS on the way. At rest, S3 encrypts every new upload by default. Decide who holds the keys.

Numbers

How much: a capacity estimate

Our example is a school photo service. Assumptions: 10 million uploads a day, 2 MB each, 10 reads for each upload, about 1 KB of metadata for each object, peak 3 times the average.

QuestionArithmeticAnswer
Uploads a second10,000,000 / 100,000100, peak 300
Reads a second100 x 101,000, peak 3,000
Upload bandwidth300 x 2 MB600 MB/s at peak
Read bandwidth3,000 x 2 MB6 GB/s at peak, so a CDN
New bytes a day10,000,000 x 2 MB20 TB
New bytes a year20 TB x 3657.3 PB before copies
On disk, 3 copies7.3 PB x 321.9 PB a year
On disk, 1.5x coding7.3 PB x 1.510.95 PB a year
Metadata a year3.65 billion x 1 KB3.65 TB
A day is about 100,000 seconds. Metadata is two thousand times smaller than the bytes, so it deserves a different kind of machine.

Each number leads to a decision

If a number changes no decision, do not calculate it.

Upload

What one upload must guarantee

Bytes first, name last

A client sends a PUT to the API gateway of the blob store. The gateway sends the bytes to a storage node in each of three zones, and then records the object in the metadata index.
The order is a requirement: a name must never point at bytes that are not safe yet.
  1. 1

    The client sends the object

    A PUT with a key the client chose.

  2. 2

    Check who asks

    Credentials, permission, size limit. Reject before reading the body.

  3. 3

    Give it an internal id

    The key stays as the client wrote it; inside, a new id lets an overwrite coexist with the old bytes.

  4. 4

    Split and spread

    Cut into chunks and store them on several nodes in several zones, with checksums.

  5. 5

    Record the metadata

    One atomic step points the key at the new bytes. From here a read sees them.

  6. 6

    Answer

    200 OK and an ETag, only now.

Summary

The whole topic in one minute.

A blob store needs few operations: create a bucket, put, get, get part of it, head, list, copy and delete. Around them sit multipart upload, temporary links, versions, lifecycle rules and encryption, each added only when a use case needs it.

The hard part is the promises. Keep durability apart from availability, choose a consistency rule, write down the limits, and turn traffic into storage, request and bandwidth numbers. Those numbers decide the design.

  • Operations are few: put, get, head, list, copy, delete, plus buckets.
  • Durability (is it still there?) and availability (can I reach it?) are separate promises.
  • Say the consistency rule out loud: read after write, last writer wins, conditions on request.
  • Write the limits down and check them on the product's own page; they change.
  • Turn traffic into storage, requests and bandwidth, and tie each number to a decision.
  • Non-goals are requirements too.

Sources