---
title: "Chunked uploads and the single car-to-house grocery trip"
date: 2023-02-05
url: https://davekiss.com/blog/chunked-uploads-and-the-single-car-to-house-grocery-trip
tags: ["learn"]
---

If you’ve ever had to carry groceries from your car into your house, then you know exactly how chunked video uploading on the internet works. Sure, your grocery totes might contain fruits and vegetables instead of bits and bytes, but it’s all the same, right?

Let me backup a bit. I’m a true suburban dad. That means that I live by these Three Suburban Commandments:

1. Thou shalt mow the lawn at least once every two weeks
1. Thou shalt get super amped when the Sunday newspaper comes with fresh crossword puzzles
1. **Thou shalt attempt to carry all groceries from thy vehicle in one trip**
For this post, it’s Commandment III that we care about.

Why? Why is one single car-to-house trip for all groceries so important? Well, for starters, I’m all about efficiency. I’m not sure about your local grocery store, but my shopping experiences are one of the most inefficient experiences I encounter during the week.

I noodle, bopping around aimlessly across aisles like a pinball amongst bumpers, sifting through the 50,000 square foot building, desperately trying to detect the ten square feet that contains my iced coffee. By the time I get home, I just want to be done with the whole damn thing, wishing instead I had stumbled across the ten square feet that stowed the whiskey.

By this point, I only have the patience for one car-to-house trip.

Single car-to-house trips are fine when you have only a bag or two to carry. It’s when you’ve got to carry double-digit grocery bags that will last your family a week that you really start to get into trouble.

If I curl my fingers just right, if I contort my arms in unnatural ways, if I balance the milk on one knee and close the trunk with my chin, then maybe, just maybe, I’ll be able to pull it off. I’ll earn the crown. I’ll be the neighborhood hero, my legacy forever remembered, the legend of the dad who ran out of patience, but saved himself a trip back out to the car.

Unfortunately, this usually ends in disaster. Dropped eggs. Exploded soda cans. If I’m lucky, a sprained ankle, dire consequences avoided by sacrificing the integrity of the bread’s shape. If I were a normal, non-lazy person, I’d carry what I could carry. I wouldn’t risk it. I’d pause, take a moment, and carry on with the task at hand.

But what, you ask, does any of this rhetorical madness have to do with uploading video on the internet?

It’s hard to visualize what digital computer files might look like in real life, but picture this: those icons that clutter your computer desktop? Each one is just like a grocery bag. The icon (or, the file it represents), is a container. By itself, it’s nothing but an empty blue plastic bag. It is the contents of that file that really tell you what’s inside.

Your grocery bags need to be packed very carefully. Frozen items are together to tell you what goes in the freezer. Fragile items are positioned carefully so as not to be damaged. Similarly, computer files contain specific bytes that tell your computer how to handle what contents are inside. Word documents contain different bytes than digital videos, which are very different from Application files, and so on.

Some of these files contain very little data and can be easily and quickly moved around. Other files (like many video files) contain lots of data and take much longer to transmit.

I’m sure you’ve seen a YouTube video before. Imagine! What wizardry goes into packing all of that real-life visual and audio representation into a playback format that can be efficiently delivered to your eyeballs over the internet? Even more confounding, how did this video get shared from a random person’s camera to YouTube in the first place? It’s a truly impressive scenario.

That random person used their web browser to share their video on YouTube. Yep, the same browser you likely use every day in some capacity, reading the New York Times, or endlessly scrolling through Twitter. Maybe you knew this much.

But did you know that your web browser also follows Suburban Commandment III?

Yes, your web browser is lazy. It wants to only have to take one trip. When Mr. Random Person decides to share a video to YouTube, the web browser would prefer to try to carry all those bits and bytes contained in the video file in one trip. One long, precarious, sketchy trip.

Wouldn’t it be safer to split the video file up into multiple bags? To stop being an impatient buffoon and take the less-risky method? After all, any number of things could happen during a single trip video upload. What happens if your Wi-Fi goes out halfway through the uploading process? What happens if you accidentally close your browser tab? What happens if a solar flare comes along and knocks out your power?

You’d have to start your trip all over again.

If, instead, we’d delivered the video with *multiple* trips, using *multiple* grocery bags, we’d have options! Perhaps, again, the Wi-Fi goes out halfway through the uploading process. (You should really switch providers away from Comcast, but I digress). Good news! Since you split your video into multiple trips, the first half of the video would have already been delivered to YouTube successfully! Once your internet came back on, you could happily pick up where you left off, carrying the remaining bags (video chunks) from your car (computer) to your house (YouTube).

This sounds like a much better idea, yeah? I agree, and so does YouTube, Mux, and many other video service providers. However, this functionality isn’t built into your browser by default. Instead, there are tools available that will slice up your video file into multiple smaller, more manageable chunks, pack them up into digital grocery bags, and help to facilitate the successful delivery to their destination.

This sounds great and all, but as for grocery stores? You won’t change my mind. I’m still going to try my hand at becoming the legendary suburban dad that carried all of the groceries in one trip.