AlgoViz

How Large Uploads Work

easy 38 min

A large file goes up in small numbered pieces.

Remember it

The few things worth knowing cold, and how to make them stick.

Memory hook

Don't guess. Send it again, let the server decide.

A wall built by basket: numbered stones, a post that counts them, fog on the river. Send the twin of stone 73. Lee places it or puts it aside, and the post says 73.

Cheat sheet

Example
400 MB, 100 x 4 MB
Piece N starts
(N - 1) x 4 MB
Piece 73
288 to 292 MB
Piece lost / reply lost
288 (72%) / 292 (73%)
Server keeps
upload ID + offset
Order
store, count, reply
Dropbox
cursor, incorrect_offset, 7 days
tus
Upload-Offset, 409, HEAD
S3
part number + ETag, overwrite
Google style
Content-Range, 308, Range

Spot it when you see

  • Large files, phones, weak networks.
  • "What if the reply is lost?"
  • "The user closed the tab."

Tricks that stick

  • The number on the post wins.
  • Silence has two meanings.
  • Bookmark and book: saved ID and the same file.
  • Sent is not saved.

Do not forget

  • Adding a repeated piece at the end.
  • Trusting the progress bar.
  • Counting before storing.
  • Keeping the session in one server's memory.
  • Mixing up Dropbox offsets and S3 part numbers.
  • No clean-up of unfinished uploads.