← Lessons

quiz vs the machine

Platinum1780

System Design

Large File Resumable Upload

Track received byte ranges so an interrupted upload restarts from the gap, not from zero.

5 min read · advanced · beat Platinum to climb

The problem

Uploading a multi gigabyte file over a flaky network will fail partway. Without resumability the client restarts from byte zero, wasting everything sent so far. Resumable upload makes the upload recover from where it stopped.

How it works

  1. The client opens a session and gets a session id that names the in progress upload.
  2. It sends the file as a sequence of byte ranges, each tagged with its offset.
  3. The server records the highest contiguous offset it has durably received.
  4. After a failure the client asks the server how far it got, then resumes from that offset.

The server, not the client, is the source of truth for progress, because only it knows what was durably stored. Each range write should be idempotent: resending the same offset must not duplicate bytes.

Key idea

Resumable upload tracks the highest durably received offset on the server so an interrupted transfer continues from the gap, with idempotent range writes preventing duplication.

Check yourself

Answer to earn rating on the learn ladder.

1. Who is the source of truth for upload progress?

2. Why must range writes be idempotent?