We don’t have large s3 files but this is still a very interesting feature. What could be the internal of this feature? Like reading into blocks and send a signal once X blocks have been processed? Sorry just thinking about traditional FS I read in textbooks 40 years ago.
That's kinda icky scenario as you'd also need right encoded video to be sent; by default most videos in mp4 container have required metadata at the end, need to use so-called fast start.
mkv, the superior container format, generally does not have that problem, you could stream mkv for encoding and then stream it back to S3 upload with no temporary files; I've found that out when I was writing encoder infra for one of our customers, first test was on bunch of mkv files and it worked beautifully, then I added more test files and mp4 just didn't worked in that setup without fussing
Hehe I knew someone would mention this, and yes you’re right maybe not the best example. Having said that, streaming transcoding absolutely exists, I implemented this whole pipeline on top of ffmpeg maybe a decade ago, and it worked when it was the right format.
(I worked for a video CDN in the past and was tasked with replacing Elastic Transcoder)
You can upload the video trailer part first - multipart allows for uploading parts out of order. Then any earlier pieces have the metadata they need for decoding.
You mean how multipart uploads are implemented? It’s really quite simple, it’s uploaded as multiple (hidden) s3 files, one by one, and then a final “commit” or “merge” which atomically concats all these files into a single final file.
The change here is that now these files are not hidden anymore.
There are probably some optimizations in place, such as ensuring all objects arrive on the exact same node and whatnot, but yeah it’s really simple.
It’s also a bit of a leaky abstraction: if you cancel a multipart upload, all those “hidden” files remain. As such, you need to set an S3 lifecycle rule to clean up all those invisible files periodically.
Thanks. That’s an interesting observation that I didn’t think about. When the user cancel a multiparty upload, why can’t the server simply remove those parts? Is it because they are being read?
Because it’s all distributed, and the server is “simple”, it’s not inherently aware of a client canceling. Well, it could, but then that would make the backend logic (much) more complicated, and you can’t differentiate between a client temporarily disrupted and retrying the upload later vs actually never going to finish, etc.
Basically these types of systems are designed to be simple, because that’s a great way to keep things stable.