The Engineering Behind Everyday Apps: Netflix, Live Cricket, WhatsApp, File Uploads and Food Delivery
The apps we use every day hide some of the cleverest engineering on the internet. A film starts in a second, a message crosses an ocean before you put your phone down, and a food app shows 40 restaurants before you finish scrolling.
I have written short posts on several of these. This article brings them together and explains the few ideas they all share. The same ideas decide whether your own website or store feels fast.
1. Netflix: put the content next to the viewer
Netflix does not stream most films from a single data centre far away. It runs its own content delivery network, called Open Connect, and places storage servers inside internet providers' networks and at internet exchange points around the world. Popular titles are copied to those servers overnight, before anyone presses play.
Each title is also encoded many times, at different qualities. The player measures your connection every few seconds and switches between them. This is called adaptive bitrate streaming. It is why the picture goes soft for a moment instead of stopping to buffer.
The lesson: distance is slow. Serve content from as close to the user as possible. More in Why Netflix Loads Faster Than Your Excuses.
2. Live cricket: cut the stream into small pieces
Live streaming to millions of people at once works differently from a video call. The broadcast is cut into short segments, a few seconds each, and published using protocols like HLS or DASH. Viewers do not connect to the origin server. They download the same small files from CDN servers near them, and the CDN copies each segment out to thousands of locations.
The cost of this design is a delay. An online stream often runs several seconds or more behind live TV, which is why a neighbour sometimes cheers before you see the wicket. Engineers trade a little delay for the ability to serve millions of viewers without the stream falling over.
More in How 50 Million People Watch Live Cricket at Once.
3. WhatsApp: store, forward and encrypt
When you send a WhatsApp message, your phone encrypts it with the Signal protocol before it leaves the device. WhatsApp's servers cannot read it. They hold the encrypted message until your contact's phone is online, deliver it, then delete it.
The ticks show this journey. One grey tick means the server has the message. Two grey ticks mean it reached the other phone. Blue ticks mean it was read. The servers keep millions of connections open at once, so a message can be pushed to a phone the moment it arrives instead of the phone having to keep asking.
More in How Your WhatsApp Message Crosses Oceans in Seconds.
4. File uploads: send it in chunks, straight to storage
A large upload over a weak mobile connection will fail if it is sent as one piece. Modern apps split the file into chunks and upload them separately, so a dropped connection only means resending one chunk, not the whole file. This is called resumable or multipart upload.
Well-built apps also skip their own servers. The server gives the app a short-lived, signed link, and the app uploads directly to cloud storage such as Amazon S3. The app's server stays free for everything else, and slower tasks like virus scanning, thumbnails and video conversion happen in the background after the upload finishes.
More in The Engineering Behind Your File Upload.
5. Food apps: answer the most common question in advance
"Which restaurants deliver to me right now?" is asked millions of times a day, so food apps make it cheap to answer. Restaurant locations are stored in a geospatial index that can find everything within a delivery area quickly. Results for busy areas are cached, menus and photos come from a CDN, and the app loads the first screen of results before fetching the rest as you scroll.
More in How a Food App Loads 40 Restaurants in Under 2 Seconds.
The four ideas behind all of them
- Move content closer to the user. CDNs and edge servers beat even the fastest data centre that is far away.
- Break big jobs into small pieces. Video segments and upload chunks fail and recover cheaply.
- Do slow work in the background. Keep the user's request fast, and process the rest afterwards.
- Prepare common answers in advance. Caching and pre-loading turn hard questions into quick lookups.
None of this is only for giants. The same ideas make a Shopify store or a property CRM feel fast: images served from a CDN, heavy imports run as background jobs, and common pages cached. If your site or app feels slow, see my development services or send me a message.
Sources: Netflix Open Connect overview (openconnect.netflix.com). Apple HLS and MPEG-DASH specifications. WhatsApp encryption overview and Signal protocol documentation. Amazon S3 documentation on multipart uploads and presigned URLs.