- TCP provides reliable delivery for a single connection by retransmitting lost packets and ensuring ordered delivery.
- When a TCP connection is torn down, the new connection has no inherent memory of what the previous connection acknowledged.
- To avoid reuploading the whole file after a broken connection, the server must persist upload progress across connections. This is the essence of resumable uploads.
- As the client uploads bytes to the upload URL, the server writes received bytes to persistent storage and updates the committed offset (the number of bytes safely persisted).
- If the connection breaks after 14 GB, the server’s persisted committed offset will reflect whatever it has safely written (for example, 14.0 GB).
- The client may believe it sent slightly more (14.2 GB) due to local buffering or unconfirmed retransmits, but the server’s persisted offset is the authoritative source of truth.
- Append to a file on durable storage and atomically update an offset vector or metadata document.
- Store chunks in an object store and record a manifest of committed byte ranges.
- Use a transactional write that ensures the committed offset is only advanced when bytes are durable.
- The client reconnects and issues a small request to the same upload URL to ask for the server’s committed offset.
- The server responds with the saved position (the committed offset).
- The client resumes sending bytes starting from that offset; only the remaining bytes are transferred.
- Client asks for the offset:
GET /upload?id=7Fq2orHEAD /upload?id=7Fq2
- Server responds with an offset header:
Upload-Offset: 15000000000(tuS-style)- or
Range: bytes=0-15999999999(some implementations indicate the last committed byte)
- Client resumes using
Content-Rangeheader when sending the next chunk:
Content-Range for chunk uploads or protocols like tus (which uses Upload-Offset).
Important clarifications
- Resumable uploads do not require the file to be pre-split into multiple logical chunks. In theory, a file could be transferred in one long request and still be resumable if the server persistently records progress and exposes the committed offset.
- In practice, chunked uploads (multiple smaller requests) are common because they simplify retries, parallelism, and progress tracking.
- Upload sessions can expire due to timeouts or server policies. If a session has expired, the client may need to create a new session and start over.
Treat the server-side committed offset as the authoritative source of truth for how many bytes of the file have been received. Resumable uploads are about making upload progress survive broken connections by persisting that progress and exposing it to subsequent connections.
Summary
- TCP reliability helps only while the same connection remains open.
- Resumable uploads solve connection drops by creating a server-side upload session (tied to a unique URL or ID) and persisting how many bytes have been committed.
- On reconnection, the client queries the upload session for the committed offset and resumes uploading from that position, avoiding a full reupload.
- TCP overview: https://en.wikipedia.org/wiki/Transmission_Control_Protocol
- HTTP Content-Range (RFC 7233): https://datatracker.ietf.org/doc/html/rfc7233
- tus resumable upload protocol: https://tus.io/
- Google resumable upload (for API examples): https://developers.google.com/drive/api/v3/manage-uploads