How Large Uploads Work
easy 38 minA large file goes up in small numbered pieces.
Check yourself
One question at a time. Each answer explains why.
Question 1 of 12
Where does piece 73 start if pieces are 4 MB and counted from 1?
No reply came for piece 73. What does the client know?
Piece 73 arrives again and the server already has 292 MB. What should it do?
The server has 288 MB and gets piece 76 at offset 300 MB. What now?
Who decides where the upload continues?
Why must the user choose the file again after a reload?
The bar shows 100%, then the connection breaks. Is the file stored?
Why are TCP retransmissions not enough?
An S3 part 7 is uploaded twice with the same part number. What happens?
Dropbox answers incorrect_offset with correct_offset 292000000. You:
Which order is safe on the server?
400 MB at 8 Mbit/s. How long does one 4 MB piece take?
Pick an answer to see why.
Not quite. (73 - 1) x 4 = 288. Piece 72 starts at 284, and 292 is where 73 ends.
Not quite. Both look like silence. So it sends the piece again and lets the server decide.
Not quite. The piece ends at 292, so it is stored completely. The client then sends piece 74.
Not quite. There would be a hole from 288 to 300. The answer tells the client where to continue.
Not quite. Only the server knows what is stored.
Not quite. Otherwise any page could read your disk. A stored handle with permission is the exception in some browsers.
Not quite. The bar counts bytes sent. They can still be in buffers.
Not quite. A new address, a proxy timeout or a closed tab ends the connection and everything it remembered.
Not quite. On S3 the part number is the identity. incorrect_offset is Dropbox's answer.
Not quite. The earlier piece was saved and only its reply was lost.
Not quite. A crash between store and count only means storing the same piece again.
Not quite. 8 Mbit/s is 1 MB per second.
Flashcards
Say your answer, then reveal it.
Card 1 of 15
Piece N starts at?
(N - 1) x piece size, counting from 1. Piece 73 of 4 MB: 288 MB.
Say your answer, then reveal it.
What three things does a resumable upload need?
An upload ID, an offset kept by the server, and the rule that the server's number wins.
Say your answer, then reveal it.
No reply to piece 73. What are the two truths?
Request lost: the server has 288 MB. Reply lost: it has 292 MB.
Say your answer, then reveal it.
What does the client do after no reply?
Waits, sends the same piece with the same offset again, and follows the server's number.
Say your answer, then reveal it.
Piece arrives at the expected offset?
Save the bytes, move the number, reply with it.
Say your answer, then reveal it.
Piece is already stored?
Write nothing. Answer with the number, 292. The client sends piece 74.
Say your answer, then reveal it.
Why is 100% on the bar not finished?
It counts bytes sent. They may be in a buffer or a proxy. Wait for the reply to finish.
Say your answer, then reveal it.
What does TCP not do?
Survive the end of the connection, remember uploads, or promise that bytes were stored.
Say your answer, then reveal it.
Tab closed: what is needed to continue?
The saved upload ID and the same file, chosen again by the user.
Say your answer, then reveal it.
How to recognise the same file?
Name, size, last modified, hash of the first bytes. Hashes of all pieces to be sure.
Say your answer, then reveal it.
Dropbox: wrong offset?
incorrect_offset with correct_offset. Continue there. Sessions live 7 days.
Say your answer, then reveal it.
S3: same part number again?
Overwrites the earlier part. Finish lists part numbers with ETags.
Say your answer, then reveal it.
Google range style: what does 308 say?
Not finished. The Range header tells the last saved byte.
Say your answer, then reveal it.
Store, count, reply: why this order?
The number never promises bytes that were not stored.
Say your answer, then reveal it.
What is a hash of hashes?
Hash each piece, join the hashes in order, hash again. It checks order and presence.
Say your answer, then reveal it.
These cards come back in Today, just before you would forget them.